Class GameObject
Assembly: UnityEngine.dll
Syntax
public sealed class GameObject : Object
Constructors
|
Improve this Doc
View Source
GameObject()
Declaration
|
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
activeInHierarchy
Declaration
public bool activeInHierarchy { get; }
Property Value
activeSelf
Declaration
public bool activeSelf { get; }
Property Value
|
Improve this Doc
View Source
gameObject
Declaration
public GameObject gameObject { get; }
Property Value
isStatic
Declaration
public bool isStatic { get; set; }
Property Value
layer
Declaration
public int layer { get; set; }
Property Value
scene
Declaration
public Scene scene { get; }
Property Value
tag
Declaration
public string tag { get; set; }
Property Value
Declaration
public Transform transform { get; }
Property Value
Methods
|
Improve this Doc
View Source
AddComponent(Type)
Declaration
[TypeInferenceRule(TypeInferenceRules.TypeReferencedByFirstArgument)]
public Component AddComponent(Type componentType)
Parameters
Type |
Name |
Description |
Type |
componentType |
|
Returns
|
Improve this Doc
View Source
AddComponent<T>()
Declaration
public T AddComponent<T>()
where T : Component
Returns
Type Parameters
|
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
BroadcastMessage(String, Object, SendMessageOptions)
Declaration
public void BroadcastMessage(string methodName, [DefaultValue("null")] object parameter, [DefaultValue("SendMessageOptions.RequireReceiver")] SendMessageOptions options)
Parameters
|
Improve this Doc
View Source
BroadcastMessage(String, SendMessageOptions)
Declaration
public void BroadcastMessage(string methodName, SendMessageOptions options)
Parameters
CompareTag(String)
Declaration
public bool CompareTag(string tag)
Parameters
Type |
Name |
Description |
String |
tag |
|
Returns
CreatePrimitive(PrimitiveType)
Declaration
public static GameObject CreatePrimitive(PrimitiveType type)
Parameters
Returns
Find(String)
Declaration
public static GameObject Find(string name)
Parameters
Type |
Name |
Description |
String |
name |
|
Returns
FindGameObjectsWithTag(String)
Declaration
public static GameObject[] FindGameObjectsWithTag(string tag)
Parameters
Type |
Name |
Description |
String |
tag |
|
Returns
FindGameObjectWithTag(String)
Declaration
public static GameObject FindGameObjectWithTag(string tag)
Parameters
Type |
Name |
Description |
String |
tag |
|
Returns
|
Improve this Doc
View Source
FindWithTag(String)
Declaration
public static GameObject FindWithTag(string tag)
Parameters
Type |
Name |
Description |
String |
tag |
|
Returns
|
Improve this Doc
View Source
GetComponent(String)
Declaration
public Component GetComponent(string type)
Parameters
Type |
Name |
Description |
String |
type |
|
Returns
GetComponent(Type)
Declaration
[TypeInferenceRule(TypeInferenceRules.TypeReferencedByFirstArgument)]
public Component GetComponent(Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
|
Improve this Doc
View Source
GetComponent<T>()
Declaration
public T GetComponent<T>()
Returns
Type Parameters
|
Improve this Doc
View Source
GetComponentInChildren(Type)
Declaration
[TypeInferenceRule(TypeInferenceRules.TypeReferencedByFirstArgument)]
public Component GetComponentInChildren(Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
GetComponentInChildren(Type, Boolean)
Declaration
[TypeInferenceRule(TypeInferenceRules.TypeReferencedByFirstArgument)]
public Component GetComponentInChildren(Type type, bool includeInactive)
Parameters
Type |
Name |
Description |
Type |
type |
|
Boolean |
includeInactive |
|
Returns
|
Improve this Doc
View Source
GetComponentInChildren<T>()
Declaration
[ExcludeFromDocs]
public T GetComponentInChildren<T>()
Returns
Type Parameters
|
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 Parameters
GetComponentInParent(Type)
Declaration
[TypeInferenceRule(TypeInferenceRules.TypeReferencedByFirstArgument)]
public Component GetComponentInParent(Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
|
Improve this Doc
View Source
GetComponentInParent<T>()
Declaration
public T GetComponentInParent<T>()
Returns
Type Parameters
|
Improve this Doc
View Source
GetComponents(Type)
Declaration
public Component[] GetComponents(Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
|
Improve this Doc
View Source
GetComponents(Type, List<Component>)
Declaration
public void GetComponents(Type type, List<Component> results)
Parameters
|
Improve this Doc
View Source
GetComponents<T>()
Declaration
public T[] GetComponents<T>()
Returns
Type Parameters
|
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
|
Improve this Doc
View Source
GetComponentsInChildren(Type)
Declaration
[ExcludeFromDocs]
public Component[] GetComponentsInChildren(Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
|
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
|
Improve this Doc
View Source
GetComponentsInChildren<T>()
Declaration
public T[] GetComponentsInChildren<T>()
Returns
Type Parameters
|
Improve this Doc
View Source
GetComponentsInChildren<T>(Boolean)
Declaration
public T[] GetComponentsInChildren<T>(bool includeInactive)
Parameters
Type |
Name |
Description |
Boolean |
includeInactive |
|
Returns
Type Parameters
|
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
|
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
|
Improve this Doc
View Source
GetComponentsInParent(Type)
Declaration
[ExcludeFromDocs]
public Component[] GetComponentsInParent(Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
|
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
|
Improve this Doc
View Source
GetComponentsInParent<T>()
Declaration
public T[] GetComponentsInParent<T>()
Returns
Type Parameters
|
Improve this Doc
View Source
GetComponentsInParent<T>(Boolean)
Declaration
public T[] GetComponentsInParent<T>(bool includeInactive)
Parameters
Type |
Name |
Description |
Boolean |
includeInactive |
|
Returns
Type Parameters
|
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
|
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
SendMessage(String, Object, SendMessageOptions)
Declaration
public void SendMessage(string methodName, [DefaultValue("null")] object value, [DefaultValue("SendMessageOptions.RequireReceiver")] SendMessageOptions options)
Parameters
|
Improve this Doc
View Source
SendMessage(String, SendMessageOptions)
Declaration
public void SendMessage(string methodName, SendMessageOptions options)
Parameters
|
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
SendMessageUpwards(String, Object, SendMessageOptions)
Declaration
public void SendMessageUpwards(string methodName, [DefaultValue("null")] object value, [DefaultValue("SendMessageOptions.RequireReceiver")] SendMessageOptions options)
Parameters
|
Improve this Doc
View Source
SendMessageUpwards(String, SendMessageOptions)
Declaration
public void SendMessageUpwards(string methodName, SendMessageOptions options)
Parameters
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