Unity 场景中所有实体的基类。
Note: Many variables in the GameObject class have been removed. To access GameObject.renderer in csharp, for example, use GetComponent<Renderer>() instead.
Additional resources: Component.
activeInHierarchy | 定义 GameObject 在 Scene 中是否处于活动状态。 |
activeSelf | 此 GameObject 的本地活动状态。(只读) |
isStatic | 获取并设置 GameObject 的 StaticEditorFlags。 |
layer | The layer the GameObject is in. |
scene | 该 GameObject 所属的场景。 |
sceneCullingMask | Unity 用于确定在哪个场景中渲染该 GameObject 的场景剔除遮罩。 |
tag | The tag of this GameObject. |
transform | 附加到此 GameObject 的 Transform。 |
GameObject | Creates a new GameObject, named name. |
AddComponent | Adds a component class of type componentType to the GameObject. C# Users can use a generic version. |
BroadcastMessage | Calls the method named methodName on every MonoBehaviour in this GameObject or any of its children. |
CompareTag | Is this GameObject tagged with tag ? |
GetComponent | Gets a reference to a component of type T on the specified GameObject. |
GetComponentInChildren | Gets a reference to a component of type T on the specified GameObject, or any child of the GameObject. |
GetComponentInParent | Gets a reference to a component of type T on the specified GameObject, or any parent of the GameObject. |
GetComponents | Gets references to all components of type T on the specified GameObject. |
GetComponentsInChildren | Gets references to all components of type T on the specified GameObject, and any child of the GameObject. |
GetComponentsInParent | Gets references to all components of type T on the specified GameObject, and any parent of the GameObject. |
SendMessage | Calls the method named methodName on every MonoBehaviour in this GameObject. |
SendMessageUpwards | Calls the method named methodName on every MonoBehaviour in this GameObject and on every ancestor of the behaviour. |
SetActive | 根据给定的值 true 或 /false/,激活/停用 GameObject。 |
TryGetComponent | 获取指定类型的组件(如果存在)。 |
CreatePrimitive | Creates a GameObject with a primitive mesh renderer and appropriate collider. |
Find | 按 name 查找 GameObject,然后返回它。 |
FindGameObjectsWithTag | 返回标签为 tag 的活动 GameObjects 的数组。如果未找到任何 GameObject,则返回空数组。 |
FindWithTag | 返回一个标记为 tag 的活动 GameObject。如果未找到 GameObject,则返回 null。 |
GetScene | Returns the Scene of a GameObject given by instance ID. |
InstantiateGameObjects | Instantiate a GameObject multiple times by instance ID and populate NativeArrays containing the new GameObjects by instance ID and their corresponding Transforms by instance ID. |
SetGameObjectsActive | Activates/Deactivates the GameObjects by instance ID, depending on the given true or false value. |
GetInstanceID | Gets the instance ID of the object. |
ToString | 返回对象的名称。 |
Destroy | 移除 GameObject、组件或资源。 |
DestroyImmediate | 立即销毁对象 /obj/。强烈建议您改用 Destroy。 |
DontDestroyOnLoad | 在加载新的 Scene 时,请勿销毁 Object。 |
FindAnyObjectByType | Retrieves any active loaded object of Type type. |
FindFirstObjectByType | Retrieves the first active loaded object of Type type. |
FindObjectsByType | Retrieves a list of all loaded objects of Type type. |
Instantiate | 克隆 original 对象并返回克隆对象。 |
bool | 该对象是否存在? |
operator != | 比较两个对象是否引用不同的对象。 |
operator == | 比较两个对象引用,判断它们是否引用同一个对象。 |