Skip to main content

GameObject

info

GameObject inherits from Object

Base class for all entities in Unity Scenes. Unity GameObject

Members

Properties

NameDescription
GameObject.activeInHierarchyDefines whether the GameObject is active in the Scene.
GameObject.activeSelfThe local active state of this GameObject. (Read Only)
GameObject.isStaticGets and sets the GameObject's StaticEditorFlags.
GameObject.layerThe layer the game object is in.
GameObject.OwnerCurrent 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.sceneScene that the GameObject is part of.
GameObject.tagThe tag of this game object.
GameObject.transformThe Transform attached to this GameObject.

Constructor

NameDescription
GameObject()Creates a new game object.

Methods

NameDescription
GameObject.AddComponent(componentType)Adds a component class of type componentType to the game object.
GameObject.BroadcastMessage(methodName, parameter=nil)Calls the method named methodName on every lua script in this game object or any of its children.
GameObject.CompareTag(tag)Is this game object tagged with tag ?
GameObject.GetAllLuaScripts()Returns an array of all Lua scripts that attached to the game object.
GameObject.GetComponent(type)Returns the component of Type type if the game object has one attached, null if it doesn't.
GameObject.GetComponentInChildren(type)Returns the component of Type type in the GameObject or any of its children using depth first search.
GameObject.GetComponentInParent(type)Retrieves the component of Type type in the GameObject or any of its parents.
GameObject.GetComponents(type)Returns all components of Type type in the GameObject.
GameObject.GetComponentsInChildren(type)Returns all components of Type type in the GameObject or any of its children.
GameObject.GetComponentsInParent(type)Returns all components of Type type in the GameObject or any of its parents.
GameObject.GetPlayer()Returns a MLPlayer object if this object or any of its ancestors is a ML Player. Null Otherwise.
GameObject.IsPlayer()Returns true if this object or any of the ancestors of this object is a ML player.
GameObject.RequestOwnership()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)Calls the method named methodName on every lua script in this game object.
GameObject.SendMessageUpwards(methodName, value=nil)Calls the method named methodName on every MonoBehaviour in this game object and on every ancestor of the behaviour.
GameObject.SetActive(value)Activates/Deactivates the GameObject, depending on the given true or false value.
GameObject.TryGetComponent(type)Gets the component of the specified type, if it exists.

Static Methods

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

Inherited Members

Inherited Properties

NameDescription
GameObject.hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
GameObject.nameThe name of the object.

Inherited Methods

NameDescription
GameObject.GetInstanceID()Returns the instance id of the object.