Skip to content

GameObject

extends EngineObject

Game entity object class used to manipulate various entity objects in the game.

构造方法

GameObject.new ( name : string? )

成员变量

GameObject.instanceID : number
(Read Only) The instance ID of the current object.
GameObject.transform : Transform
(Read Only) The transform property of the current object.
GameObject.name : string
The name of the current object.
GameObject.scene : Scene
(Read Only) The scene in which the current object is located.
GameObject.allowEnable : boolean
(Read Only) The chained enable state of the current object in the object tree it belongs to.
GameObject.isStatic : boolean
(Read Only) Whether the current object is a static object.
GameObject.enable : boolean
Whether the current object is enabled.
GameObject.layer : number
The layer of the current object.

成员方法

GameObject.GetComponents ( type : Component ) : T|null []
Returns all components of type type in the GameObject.
GameObject.AddComponent ( type : Component ) : T|null
根据组件类型为当前游戏对象添加组件。
GameObject.GetComponentsInChildren ( type : Component ) : T|null []
Get all instances of a specified type of component in a GameObject and all its child GameObjects.
GameObject.GetComponent ( type : Component ) : T|null
Get the component on the game object by specifying the type of the component.
GameObject.GetComponentInChildren ( type : Component ) : T|null
Get the first component of the specified type on the specified game object or any of its child objects.
GameObject.GetComponentsInParent ( type : Component ) : T|null []
Get all instances of a specified component type in a GameObject and all its parent GameObjects.
GameObject.GetComponentInParent ( type : Component ) : T|null
Get the first component of the specified type on the specified game object or any of its parent game objects.

静态方法

GameObject.DestroyGameObject ( go : GameObject ) : void
Destroy the game object.
GameObject.DestroyComponent ( com : Component ) : void
Remove a component from a game object.
GameObject.CreatePrimitive ( type : PrimitiveType ) : GameObject
Create a GameObject object with a MeshRenderer component and mesh data corresponding to the type specified.
GameObject.Instantiate ( origin : GameObject ) : GameObject
Instantiate an entity object with the same properties as the parameter object.