Attention
You are viewing PyUnity docs under the develop
branch.
As such, they are only applicable if you installed from source.
Go to https://docs.pyunity.x10.bz/en/latest/ for the most recent
release.
pyunity.scenes.sceneManager module¶
Source code: pyunity/scenes/sceneManager.py
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:
- 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:
- 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:
- 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:
- Raises:
PyUnityException – 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 Scene
PyUnityException – 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 string
PyUnityException – When there is no scene named
name
- 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 integer
PyUnityException – When there is no scene at index
index
- 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
Scene
PyUnityException – 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.