Skip to content

API > GameObject


GameObject⚓︎

GameObject inherits from Object

Base class for all entities in Unity Scenes. Unity GameObject

Members⚓︎

Properties⚓︎

Name Description
GameObject.activeInHierarchyProperty Defines whether the GameObject is active in the Scene.
GameObject.activeSelfPropertyReadonly Property The local active state of this GameObject. (Read Only)
GameObject.isStaticProperty Gets and sets the GameObject's StaticEditorFlags.
GameObject.layerProperty The layer the game object is in.
GameObject.OwnerProperty Current Network owner of this game object. Network ownership allows a certain client to modify properties of a game object if that game object or any of its parent or grand parents are synchronized using MLSynchronizer. Nil of the object is not own by any player.
GameObject.sceneProperty Scene that the GameObject is part of.
GameObject.tagProperty The tag of this game object.
GameObject.transformProperty The Transform attached to this GameObject.

Constructor⚓︎

Name Description
GameObject()Constructor Creates a new game object.

Methods⚓︎

Name Description
GameObject.AddComponent(componentType) Method Adds a component class of type componentType to the game object.
GameObject.BroadcastMessage(methodName, parameter=nil) Method Calls the method named methodName on every lua script in this game object or any of its children.
GameObject.CompareTag(tag) Method Is this game object tagged with tag ?
GameObject.GetAllLuaScripts() Method Returns an array of all Lua scripts that attached to the game object.
GameObject.GetComponent(type) Method Returns the component of Type type if the game object has one attached, null if it doesn't.
GameObject.GetComponentInChildren(type) Method Returns the component of Type type in the GameObject or any of its children using depth first search.
GameObject.GetComponentInParent(type) Method Retrieves the component of Type type in the GameObject or any of its parents.
GameObject.GetComponents(type) Method Returns all components of Type type in the GameObject.
GameObject.GetComponentsInChildren(type) Method Returns all components of Type type in the GameObject or any of its children.
GameObject.GetComponentsInParent(type) Method Returns all components of Type type in the GameObject or any of its parents.
GameObject.GetPlayer() Method Returns a MLPlayer object if this object or any of its ancestors is a ML Player. Null Otherwise.
GameObject.IsPlayer() Method Returns true if this object or any of the ancestors of this object is a ML player.
GameObject.RequestOwnership() Method Transfers the Network ownership of this object to current client (the client called this method). Network ownership allows a certain client to modify properties of a game object if that game object or any of its parent or grandparents are synchronized using MLSynchronizer.
GameObject.SendMessage(methodName, value=nil) Method Calls the method named methodName on every lua script in this game object.
GameObject.SendMessageUpwards(methodName, value=nil) Method Calls the method named methodName on every MonoBehaviour in this game object and on every ancestor of the behaviour.
GameObject.SetActive(value) Method Activates/Deactivates the GameObject, depending on the given true or false value.
GameObject.TryGetComponent(type) Method Gets the component of the specified type, if it exists.

Static Methods⚓︎

Name Description
GameObject.CreatePrimitive(type) Static fieldMethod Creates a game object with a primitive mesh renderer and appropriate collider.
GameObject.Find(name) Static fieldMethod Finds a GameObject by name and returns it.
GameObject.FindGameObjectsWithTag(tag) Static fieldMethod Returns an array of active GameObjects tagged tag. Returns empty array if no GameObject was found.

Inherited Members⚓︎

Inherited Properties⚓︎

Name Description
GameObject.hideFlagsProperty Should the object be hidden, saved with the Scene or modifiable by the user?
GameObject.nameProperty The name of the object.

Inherited Methods⚓︎

Name Description
GameObject.GetInstanceID()Method Returns the instance id of the object.