2021-01-10 08:42

Best way to change back and forth between scenes?

So, I am working on a project and the entire time it has been basically in only one scene and that has worked fine. However, I am trying to add a tutorial like scene to introduce the user to the controls. Once they finish going through the tutorial they will go back to the start up. What I have come to notice that because the InputManager persists through scene changes you need the camera and cursor to do so as well otherwise it throws a bunch of different errors that are really hard to track down why they are happening. By making the camera and cursor DontDestroyOnLoad it has solved the issue of going to a different scene. However, whenever I go back to the first scene, Unity basically yells at me for having two cursors and cameras in the scene. What is a workaround for this? Am I going about doing this the right way? Is there a certain way that we should handle scene changes?


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • weixin_39922929 weixin_39922929 4月前

    You can look at the way GalaxyExplorer handles this. Basically it has a scene called CoreSystems that is responsible for all of the MRTKish Singletons. Every other scene in the project has a script called ViewLoader that checks to see if CoreSystems is loaded. If it isn't that script loads CoreSystems before it proceeds.

    点赞 评论 复制链接分享
  • weixin_39878688 weixin_39878688 4月前

    This is referenced in #1823 with some possible fixes listed

    点赞 评论 复制链接分享
  • weixin_39588206 weixin_39588206 4月前

    Discussed in #1823 and I tried it in my personal project. Have a Master scene with common elements only, such as MixedRealityCamera, InputManager, DefaultCursor then, load the first scene and replace with other scenes. (SceneManager.UnloadScene/LoadScene)

    点赞 评论 复制链接分享
  • weixin_39926040 weixin_39926040 4月前

    Probably best to have a master scene, and additive load and unload as needed.

    点赞 评论 复制链接分享
  • weixin_39818550 weixin_39818550 4月前

    Closing issues older than 180 days. If this is still an issue, please reactivate with recent information.

    点赞 评论 复制链接分享