You should now have a project panel with seven folders and a scene with Main Camera and OuyaGameObject that you have entered your developer ID into. We are going to use this scene as a setup scene that isn't displayed for long but instead adds all the required game objects. Normally in Unity, when loading a new scene, all objects are destroyed, and then the objects in the new scene are loaded. If it is needed to have an object persist between scenes then there is a method, DontDestroyOnLoad
that you can pass an object to. If the object is a component or GameObject then its entire transform hierarchy will not be destroyed either. A side effect of this is that if the scene has the GameObject added to it in Unity and you load it multiple times (on a level select screen for example) then the GameObject will be cloned multiple times and, with a GameObject that handles controller input for example, this can result in multiple controller presses being triggered. We can avoid this by having all our GameObjects that require DontDestroyOnLoad
being instantiated on a scene that we will only ever load the one time.
As we won't be displaying anything on this scene, you should delete Main Camera. We'll also need a mechanism to leave this scene and load the next one, by performing the following steps:
SetUp
by clicking on File | Save Scene, and select the Scenes folder you created earlier.TitleScreen
and click on Save.18.191.29.22