pyunity.scenes.sceneManager module¶
Module that manages creation and deletion of Scenes.
-
pyunity.scenes.sceneManager.AddScene(sceneName)[source]¶ Add a scene to the SceneManager. Pass in a scene name to create a scene.
Parameters: sceneName (str) – Name of the scene Returns: Newly created scene Return type: Scene Raises: PyUnityException– If there already exists a scene called sceneName
-
pyunity.scenes.sceneManager.AddBareScene(sceneName)[source]¶ Add a scene to the SceneManager. Pass in a scene name to create a scene.
Parameters: sceneName (str) – Name of the scene Returns: Newly created scene Return type: Scene Raises: PyUnityException– If there already exists a scene called sceneName
-
pyunity.scenes.sceneManager.GetSceneByIndex(index)[source]¶ Get a scene by its index.
Parameters: index (int) – Index of the scene Returns: Specified scene at index index Return type: Scene Raises: IndexError– If there is no scene at the specified index
-
pyunity.scenes.sceneManager.GetSceneByName(name)[source]¶ Get a scene by its name.
Parameters: name (str) – Name of the scene Returns: Specified scene with name of name Return type: Scene Raises: KeyError– If there is no scene called name
-
pyunity.scenes.sceneManager.RemoveScene(scene)[source]¶ Removes a scene from the SceneManager.
Parameters: scene (Scene) – Scene to remove
Raises: TypeError– If the provided scene is not type ScenePyUnityException– If the scene is not part of the SceneManager
-
pyunity.scenes.sceneManager.LoadSceneByName(name)[source]¶ Loads a scene by its name.
Parameters: name (str) – Name of the scene
Raises: TypeError– When the provided name is not a stringPyUnityException– When there is no scene namedname
-
pyunity.scenes.sceneManager.LoadSceneByIndex(index)[source]¶ Loads a scene by its index of when it was added to the SceneManager.
Parameters: index (int) – Index of the scene
Raises: TypeError– When the provided index is not an integerPyUnityException– When there is no scene at indexindex
-
pyunity.scenes.sceneManager.LoadScene(scene)[source]¶ Load a scene by a reference.
Parameters: scene (Scene) – Scene to be loaded
Raises: TypeError– When the scene is not of type ScenePyUnityException– When the scene is not part of the SceneManager. This is checked because the SceneManager has to make some checks before the scene can be run.