GameObject
class in UnityEngine · UnityEngine.CoreModule · inherits from Object
SendMessage, BroadcastMessage and SendMessageUpwards: call a method by name (any visibility, no parameter or one that takes the value) on every MonoBehaviour of an active GameObject, disabled ones included, as Unity does. With RequireReceiver, no receiver at all is an error.
Constructors 1
Properties 9
bool activeInHierarchy { get; }bool activeSelf { get; }GameObject gameObject { get; }bool isStatic { get; set; }Whether the object is marked static (any static flag); setting it sets all flags or none, as the Inspector's Static checkbox does.
int layer { get; set; }The layer (0-31), used by physics collision filtering and query masks.
UnityEngine.SceneManagement.Scene scene { get; }The scene this object belongs to: its root's.
ulong sceneCullingMask { get; }string tag { get; set; }The tag. Any tag is accepted until project settings (the tag list) are imported; Unity rejects tags its TagManager doesn't define.
Transform transform { get; }Methods 18
T AddComponent<T>()Component AddComponent(Type componentType)void BroadcastMessage(string methodName)void BroadcastMessage(string methodName, object? parameter)void BroadcastMessage(string methodName, SendMessageOptions options)void BroadcastMessage(string methodName, object? parameter, SendMessageOptions options)bool CompareTag(string tag)static GameObject CreatePrimitive(PrimitiveType type)A built-in primitive with its MeshFilter, collider and MeshRenderer (Default-Material).
static GameObject? Find(string name)An active GameObject in the scene by name, or by path from a root ("Level/Player"; a leading '/' anchors at the roots). Null if none.
static GameObject? FindGameObjectWithTag(string tag)static GameObject[] FindGameObjectsWithTag(string tag)Every active GameObject with the tag, in hierarchy order.
static GameObject? FindWithTag(string tag)An active GameObject with the tag, or null.
T GetComponent<T>()Component GetComponent(Type type)Component GetComponentInChildren(Type type, bool includeInactive)Component GetComponentInChildren(Type type)T GetComponentInChildren<T>(bool includeInactive = false)T GetComponentInChildren<T>()This object's or the first descendant's component, depth first.
T GetComponentInParent<T>(bool includeInactive = false)T GetComponentInParent<T>()Component GetComponentInParent(Type type, bool includeInactive)Component GetComponentInParent(Type type)This object's or the nearest ancestor's component (active objects only unless includeInactive).
Component[] GetComponentsInChildren(Type type, bool includeInactive = false)T[] GetComponentsInChildren<T>(bool includeInactive = false)T[] GetComponentsInChildren<T>()void GetComponentsInChildren<T>(bool includeInactive, List<T> results)Component[] GetComponentsInParent(Type type, bool includeInactive = false)void GetComponentsInParent<T>(bool includeInactive, List<T> results)T[] GetComponentsInParent<T>(bool includeInactive = false)T[] GetComponentsInParent<T>()void SendMessage(string methodName)void SendMessage(string methodName, object? value)void SendMessage(string methodName, SendMessageOptions options)void SendMessage(string methodName, object? value, SendMessageOptions options)void SendMessageUpwards(string methodName)void SendMessageUpwards(string methodName, object? value)void SendMessageUpwards(string methodName, SendMessageOptions options)void SendMessageUpwards(string methodName, object? value, SendMessageOptions options)void SetActive(bool value)bool TryGetComponent<T>(out T component)Not in Tassix yet 7
GetComponentAtIndex GetComponentCount GetComponentIndex GetScene InstantiateGameObjects SetGameObjectsActive transformHandle