GameObject
Properties
transform (Transform)
components (Component[])
name (string)
id (string)
group (string)
active (bool)
parent (GameObject)
destroyed (bool)
Constructor
Empty constructor
Methods
create()
Instantiates the GameObject into the scene. When creating a new GameObject, it is not automatically added to the scene, this must be done manually.
Returns: self
Return Type: GameObject
destroy()
Removes the GameObject from the scene. This will make all the functions of the GameObject do nothing. The GameObject will exist in code, but not be able to do anything. Everything is set to None
in the GameObject.
setActive(active : bool)
Sets the object state to be active or disabled. Components and scripts will not be updated when the object is disabled.
addComponent(component : Component)
Adds a Component to the GameObject. This will also set the components gameObject
property to the GameObject.
Returns: Created Component
Return Type: Component
getComponent(componentName : string)
Finds the Component with the name componentName
and returns it. For names of all components, visit the Components page. May return None
if the Component is not found
Returns: Component Found
Return Type: Component
getScript(scriptName : string)
Finds the Script on the GameObject with the name scriptName
and returns it.
Returns: Script Found
Return Type: Script
removeComponent(component : Component)
Removes the Component from the GameObject.
setGroup(group : String)
Sets the game objects group to the new group. If group does not exist, a new group will be created.
setName(name : string)
Sets the name of the GameObject.
setPosition(position : Vector3)
Sets the localPosition of the GameObject.
setRotation(rotation : Vector3)
Sets the localRotation of the GameObject.
setScale(scale : Vector3)
Sets the localScale of the GameObject.
translate(translation : Vector3)
Translates the GameObject position by the given translation.
rotate(rotation : Vector3)
Rotates the GameObject rotation by the given rotation.
scale(scale : Vector3)
Scales the GameObject scale by the given scale.
updateAttributes()
Updates all the GameObject attributes. This is called in every setter function.
setParent(parent : GameObject)
Sets the GameObject parent to the given parent.
exists()
Returns True
if the GameObject is instantiated in the scene.
Returns: If GameObject exists
Return Type: bool
Class Methods
find(name : string)
Finds the GameObject with the name name
and returns it. May return None
if the GameObject is not found.
Returns: GameObject Found
Return Type: GameObject