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


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

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
pyunity.scenes.sceneManager.RemoveAllScenes()[source]

Removes all scenes from the SceneManager.

pyunity.scenes.sceneManager.LoadSceneByName(name)[source]

Loads a scene by its name.

Parameters

name (str) – Name of the scene

Raises
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
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.

pyunity.scenes.sceneManager.stopWindow()[source]
pyunity.scenes.sceneManager.CurrentScene()[source]

Gets the current scene being run