Show / Hide Table of Contents

Class GameObject

Inheritance
Object
Object
GameObject
Inherited Members
Object.GetInstanceID()
Object.GetHashCode()
Object.Equals(Object)
Object.name
Object.Instantiate(Object, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion, Transform)
Object.Instantiate(Object)
Object.Instantiate(Object, Transform)
Object.Instantiate(Object, Transform, Boolean)
Object.Instantiate<T>(T)
Object.Instantiate<T>(T, Vector3, Quaternion)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Instantiate<T>(T, Transform, Boolean)
Object.Destroy(Object, Single)
Object.Destroy(Object)
Object.DestroyImmediate(Object, Boolean)
Object.DestroyImmediate(Object)
Object.FindObjectsOfType(Type)
Object.DontDestroyOnLoad(Object)
Object.hideFlags
Object.DestroyObject(Object, Single)
Object.DestroyObject(Object)
Object.FindSceneObjectsOfType(Type)
Object.FindObjectsOfTypeIncludingAssets(Type)
Object.FindObjectsOfType<T>()
Object.FindObjectOfType<T>()
Object.FindObjectsOfTypeAll(Type)
Object.FindObjectOfType(Type)
Object.ToString()
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetType()
Object.MemberwiseClone()
Namespace: UnityEngine
Assembly: UnityEngine.dll
Syntax
public sealed class GameObject : Object

Constructors

| Improve this Doc View Source

GameObject()

Declaration
public GameObject()
| Improve this Doc View Source

GameObject(String)

Declaration
public GameObject(string name)
Parameters
Type Name Description
String name
| Improve this Doc View Source

GameObject(String, Type[])

Declaration
public GameObject(string name, params Type[] components)
Parameters
Type Name Description
String name
Type[] components

Properties

active

Declaration
[Obsolete("GameObject.active is obsolete. Use GameObject.SetActive(), GameObject.activeSelf or GameObject.activeInHierarchy.")]
public bool active { get; set; }
Property Value
Type Description
Boolean

activeInHierarchy

Declaration
public bool activeInHierarchy { get; }
Property Value
Type Description
Boolean

activeSelf

Declaration
public bool activeSelf { get; }
Property Value
Type Description
Boolean
| Improve this Doc View Source

gameObject

Declaration
public GameObject gameObject { get; }
Property Value
Type Description
GameObject

isStatic

Declaration
public bool isStatic { get; set; }
Property Value
Type Description
Boolean

layer

Declaration
public int layer { get; set; }
Property Value
Type Description
Int32

scene

Declaration
public Scene scene { get; }
Property Value
Type Description
Scene

tag

Declaration
public string tag { get; set; }
Property Value
Type Description
String

transform

Declaration
public Transform transform { get; }
Property Value
Type Description
Transform

Methods

| Improve this Doc View Source

AddComponent(Type)

Declaration
[TypeInferenceRule(TypeInferenceRules.TypeReferencedByFirstArgument)]
public Component AddComponent(Type componentType)
Parameters
Type Name Description
Type componentType
Returns
Type Description
Component
| Improve this Doc View Source

AddComponent<T>()

Declaration
public T AddComponent<T>()
    where T : Component
Returns
Type Description
T
Type Parameters
Name Description
T
| Improve this Doc View Source

BroadcastMessage(String)

Declaration
[ExcludeFromDocs]
public void BroadcastMessage(string methodName)
Parameters
Type Name Description
String methodName
| Improve this Doc View Source

BroadcastMessage(String, Object)

Declaration
[ExcludeFromDocs]
public void BroadcastMessage(string methodName, object parameter)
Parameters
Type Name Description
String methodName
Object parameter

BroadcastMessage(String, Object, SendMessageOptions)

Declaration
public void BroadcastMessage(string methodName, [DefaultValue("null")] object parameter, [DefaultValue("SendMessageOptions.RequireReceiver")] SendMessageOptions options)
Parameters
Type Name Description
String methodName
Object parameter
SendMessageOptions options
| Improve this Doc View Source

BroadcastMessage(String, SendMessageOptions)

Declaration
public void BroadcastMessage(string methodName, SendMessageOptions options)
Parameters
Type Name Description
String methodName
SendMessageOptions options

CompareTag(String)

Declaration
public bool CompareTag(string tag)
Parameters
Type Name Description
String tag
Returns
Type Description
Boolean

CreatePrimitive(PrimitiveType)

Declaration
public static GameObject CreatePrimitive(PrimitiveType type)
Parameters
Type Name Description
PrimitiveType type
Returns
Type Description
GameObject

Find(String)

Declaration
public static GameObject Find(string name)
Parameters
Type Name Description
String name
Returns
Type Description
GameObject

FindGameObjectsWithTag(String)

Declaration
public static GameObject[] FindGameObjectsWithTag(string tag)
Parameters
Type Name Description
String tag
Returns
Type Description
GameObject[]

FindGameObjectWithTag(String)

Declaration
public static GameObject FindGameObjectWithTag(string tag)
Parameters
Type Name Description
String tag
Returns
Type Description
GameObject
| Improve this Doc View Source

FindWithTag(String)

Declaration
public static GameObject FindWithTag(string tag)
Parameters
Type Name Description
String tag
Returns
Type Description
GameObject
| Improve this Doc View Source

GetComponent(String)

Declaration
public Component GetComponent(string type)
Parameters
Type Name Description
String type
Returns
Type Description
Component

GetComponent(Type)

Declaration
[TypeInferenceRule(TypeInferenceRules.TypeReferencedByFirstArgument)]
public Component GetComponent(Type type)
Parameters
Type Name Description
Type type
Returns
Type Description
Component
| Improve this Doc View Source

GetComponent<T>()

Declaration
public T GetComponent<T>()
Returns
Type Description
T
Type Parameters
Name Description
T
| Improve this Doc View Source

GetComponentInChildren(Type)

Declaration
[TypeInferenceRule(TypeInferenceRules.TypeReferencedByFirstArgument)]
public Component GetComponentInChildren(Type type)
Parameters
Type Name Description
Type type
Returns
Type Description
Component

GetComponentInChildren(Type, Boolean)

Declaration
[TypeInferenceRule(TypeInferenceRules.TypeReferencedByFirstArgument)]
public Component GetComponentInChildren(Type type, bool includeInactive)
Parameters
Type Name Description
Type type
Boolean includeInactive
Returns
Type Description
Component
| Improve this Doc View Source

GetComponentInChildren<T>()

Declaration
[ExcludeFromDocs]
public T GetComponentInChildren<T>()
Returns
Type Description
T
Type Parameters
Name Description
T
| Improve this Doc View Source

GetComponentInChildren<T>(Boolean)

Declaration
public T GetComponentInChildren<T>([DefaultValue("false")] bool includeInactive)
Parameters
Type Name Description
Boolean includeInactive
Returns
Type Description
T
Type Parameters
Name Description
T

GetComponentInParent(Type)

Declaration
[TypeInferenceRule(TypeInferenceRules.TypeReferencedByFirstArgument)]
public Component GetComponentInParent(Type type)
Parameters
Type Name Description
Type type
Returns
Type Description
Component
| Improve this Doc View Source

GetComponentInParent<T>()

Declaration
public T GetComponentInParent<T>()
Returns
Type Description
T
Type Parameters
Name Description
T
| Improve this Doc View Source

GetComponents(Type)

Declaration
public Component[] GetComponents(Type type)
Parameters
Type Name Description
Type type
Returns
Type Description
Component[]
| Improve this Doc View Source

GetComponents(Type, List<Component>)

Declaration
public void GetComponents(Type type, List<Component> results)
Parameters
Type Name Description
Type type
List<Component> results
| Improve this Doc View Source

GetComponents<T>()

Declaration
public T[] GetComponents<T>()
Returns
Type Description
T[]
Type Parameters
Name Description
T
| Improve this Doc View Source

GetComponents<T>(List<T>)

Declaration
public void GetComponents<T>(List<T> results)
Parameters
Type Name Description
List<T> results
Type Parameters
Name Description
T
| Improve this Doc View Source

GetComponentsInChildren(Type)

Declaration
[ExcludeFromDocs]
public Component[] GetComponentsInChildren(Type type)
Parameters
Type Name Description
Type type
Returns
Type Description
Component[]
| Improve this Doc View Source

GetComponentsInChildren(Type, Boolean)

Declaration
public Component[] GetComponentsInChildren(Type type, [DefaultValue("false")] bool includeInactive)
Parameters
Type Name Description
Type type
Boolean includeInactive
Returns
Type Description
Component[]
| Improve this Doc View Source

GetComponentsInChildren<T>()

Declaration
public T[] GetComponentsInChildren<T>()
Returns
Type Description
T[]
Type Parameters
Name Description
T
| Improve this Doc View Source

GetComponentsInChildren<T>(Boolean)

Declaration
public T[] GetComponentsInChildren<T>(bool includeInactive)
Parameters
Type Name Description
Boolean includeInactive
Returns
Type Description
T[]
Type Parameters
Name Description
T
| Improve this Doc View Source

GetComponentsInChildren<T>(Boolean, List<T>)

Declaration
public void GetComponentsInChildren<T>(bool includeInactive, List<T> results)
Parameters
Type Name Description
Boolean includeInactive
List<T> results
Type Parameters
Name Description
T
| Improve this Doc View Source

GetComponentsInChildren<T>(List<T>)

Declaration
public void GetComponentsInChildren<T>(List<T> results)
Parameters
Type Name Description
List<T> results
Type Parameters
Name Description
T
| Improve this Doc View Source

GetComponentsInParent(Type)

Declaration
[ExcludeFromDocs]
public Component[] GetComponentsInParent(Type type)
Parameters
Type Name Description
Type type
Returns
Type Description
Component[]
| Improve this Doc View Source

GetComponentsInParent(Type, Boolean)

Declaration
public Component[] GetComponentsInParent(Type type, [DefaultValue("false")] bool includeInactive)
Parameters
Type Name Description
Type type
Boolean includeInactive
Returns
Type Description
Component[]
| Improve this Doc View Source

GetComponentsInParent<T>()

Declaration
public T[] GetComponentsInParent<T>()
Returns
Type Description
T[]
Type Parameters
Name Description
T
| Improve this Doc View Source

GetComponentsInParent<T>(Boolean)

Declaration
public T[] GetComponentsInParent<T>(bool includeInactive)
Parameters
Type Name Description
Boolean includeInactive
Returns
Type Description
T[]
Type Parameters
Name Description
T
| Improve this Doc View Source

GetComponentsInParent<T>(Boolean, List<T>)

Declaration
public void GetComponentsInParent<T>(bool includeInactive, List<T> results)
Parameters
Type Name Description
Boolean includeInactive
List<T> results
Type Parameters
Name Description
T
| Improve this Doc View Source

SendMessage(String)

Declaration
[ExcludeFromDocs]
public void SendMessage(string methodName)
Parameters
Type Name Description
String methodName
| Improve this Doc View Source

SendMessage(String, Object)

Declaration
[ExcludeFromDocs]
public void SendMessage(string methodName, object value)
Parameters
Type Name Description
String methodName
Object value

SendMessage(String, Object, SendMessageOptions)

Declaration
public void SendMessage(string methodName, [DefaultValue("null")] object value, [DefaultValue("SendMessageOptions.RequireReceiver")] SendMessageOptions options)
Parameters
Type Name Description
String methodName
Object value
SendMessageOptions options
| Improve this Doc View Source

SendMessage(String, SendMessageOptions)

Declaration
public void SendMessage(string methodName, SendMessageOptions options)
Parameters
Type Name Description
String methodName
SendMessageOptions options
| Improve this Doc View Source

SendMessageUpwards(String)

Declaration
[ExcludeFromDocs]
public void SendMessageUpwards(string methodName)
Parameters
Type Name Description
String methodName
| Improve this Doc View Source

SendMessageUpwards(String, Object)

Declaration
[ExcludeFromDocs]
public void SendMessageUpwards(string methodName, object value)
Parameters
Type Name Description
String methodName
Object value

SendMessageUpwards(String, Object, SendMessageOptions)

Declaration
public void SendMessageUpwards(string methodName, [DefaultValue("null")] object value, [DefaultValue("SendMessageOptions.RequireReceiver")] SendMessageOptions options)
Parameters
Type Name Description
String methodName
Object value
SendMessageOptions options
| Improve this Doc View Source

SendMessageUpwards(String, SendMessageOptions)

Declaration
public void SendMessageUpwards(string methodName, SendMessageOptions options)
Parameters
Type Name Description
String methodName
SendMessageOptions options

SetActive(Boolean)

Declaration
public void SetActive(bool value)
Parameters
Type Name Description
Boolean value

SetActiveRecursively(Boolean)

Declaration
[Obsolete("gameObject.SetActiveRecursively() is obsolete. Use GameObject.SetActive(), which is now inherited by children.")]
public void SetActiveRecursively(bool state)
Parameters
Type Name Description
Boolean state

Extension Methods

MustExtensions.MustBeEqual<T>(T, T)
MustExtensions.MustBeEqual<T>(T, T, String)
MustExtensions.MustNotBeEqual<T>(T, T)
MustExtensions.MustNotBeEqual<T>(T, T, String)
MustExtensions.MustBeNull<T>(T)
MustExtensions.MustBeNull<T>(T, String)
MustExtensions.MustNotBeNull<T>(T)
MustExtensions.MustNotBeNull<T>(T, String)
  • Improve this Doc
  • View Source
Back to top Generated by DocFX