pyunity.scene module

class pyunity.scene.Scene(name)

Bases: object

Class to hold all of the GameObjects, and to run the whole scene.

Parameters

name (str) – Name of the scene

Notes

Create a scene using the SceneManager, and don’t create a scene directly using this class.

Add(gameObject)

Add a GameObject to the scene.

Parameters

gameObject (GameObejct) – The GameObject to add.

FindGameObjectsByName(name)

Finds all GameObjects matching the specified name.

Parameters

name (str) – Name of the GameObject

Returns

List of the matching GameObjects

Return type

list

FindGameObjectsByTagName(name)

Finds all GameObjects with the specified tag name.

Parameters

name (str) – Name of the tag

Returns

List of matching GameObjects

Return type

list

Raises

GameObjectException – When there is no tag named name

FindGameObjectsByTagNumber(num)

Gets all GameObjects with a tag of tag num.

Parameters

num (int) – Index of the tag

Returns

List of matching GameObjects

Return type

list

Raises

GameObjectException – If there is no tag with specified index.

List()

Lists all the GameObjects currently in the scene.

Remove(gameObject)

Remove a GameObject from the scene.

Parameters

gameObject (GameObject) – GameObject to remove.

Raises

PyUnityException – If the specified GameObject is the Main Camera.

Run()

Run the scene and create a window for it.

Start()

Start the internal parts of the Scene.

inside_frustrum(renderer)

Check if the renderer’s mesh can be seen by the main camera.

Parameters

renderer (MeshRenderer) – Renderer to test

Returns

If the mesh can be seen

Return type

bool

no_interactive()
render()

Renders all GameObjects with MeshRenderers.

start_scripts()

Start the scripts in the Scene.

transform(transform)

Transform the matrix by a specified transform.

Parameters

transform (Transform) – Transform to move

update()

Updating function to pass to the window provider.

update_scripts()

Updates all scripts in the scene.