pyunity.files module

Module to load files and scripts. Also manages project structure.

class pyunity.files.Behaviour[source]

Bases: pyunity.core.Component

Base class for behaviours that can be scripted.

gameObject

GameObject that the component belongs to.

Type:GameObject
transform

Transform that the component belongs to.

Type:Transform
AddComponent(component)

Calls AddComponent on the component’s GameObject.

Parameters:component (Component) – Component to add. Must inherit from Component
GetComponent(component)

Calls GetComponent on the component’s GameObject.

Parameters:componentClass (Component) – Component to get. Must inherit from Component
GetComponents(component)

Calls GetComponents on the component’s GameObject.

Parameters:componentClass (Component) – Component to get. Must inherit from Component
RemoveComponent(component)

Calls RemoveComponent on the component’s GameObject.

Parameters:component (Component) – Component to remove. Must inherit from Component
RemoveComponents(component)

Calls RemoveComponents on the component’s GameObject.

Parameters:component (Component) – Component to remove. Must inherit from Component
Start()[source]

Called every time a scene is loaded up.

Update(dt)[source]

Called every frame.

Parameters:dt (float) – Time since last frame, sent by the scene that the Behaviour is in.
class pyunity.files.Texture2D(path)[source]

Bases: object

Class to represent a texture.

load()[source]

Loads the texture and sets up an OpenGL texture name.

use()[source]

Binds the texture for usage. The texture is reloaded if it hasn’t already been.