Skip to content

GameObject ​

Hierarchyに表示されるGameObjectをC#から操作する参照です。GameObjectの生成・取得・親子付け・破棄を参照してください。

使い方と前提条件 · C# API一覧

型の情報 ​

  • 名前空間:NEMEngine
  • 型:NEMEngine.GameObject(Class)
  • 継承元:NEMEngine.Object

GameObject ​

csharp
public GameObject(string name = "GameObject")

引数の値で新しいインスタンスを作ります。引数の既定値は宣言を確認してください。

引数型既定値
namestringGameObject

AddBuffer ​

csharp
public DynamicBuffer<T> AddBuffer<T>() where T : unmanaged, IBufferElementData<T>

Bufferの追加削除も通常Componentと同じ安全地点で反映する

戻り値:NEMEngine.DynamicBuffer<T>。

AddComponent ​

csharp
public T AddComponent<T>() where T : Component

追加予約を含め、直後から読み書きできるComponentを返す

戻り値:T。

CompareTag ​

csharp
public bool CompareTag(string other)

指定タグと一致するか

引数型既定値
otherstring必須

戻り値:bool。

Destroy ​

csharp
public void Destroy()

GameObject 破棄。callback 中の即時破棄は走査を壊すため WorldCommandBuffer 経由で遅延適用される。 flush 後に isAlive == false。invalid / 二重破棄は安全に扱われる

Equals ​

csharp
public bool Equals(GameObject? other)

等価判定(world handle + gameObject index + gameObject generation)

引数型既定値
otherNEMEngine.GameObject?必須

戻り値:bool。

Find ​

csharp
public static GameObject? Find(string name)

名前を指定してGameObjectを検索します。

引数型既定値
namestring必須

戻り値:NEMEngine.GameObject?。

FindGameObjectsWithTag ​

csharp
public static GameObject[] FindGameObjectsWithTag(string tag)

指定タグのGameObjectをすべて取得します。

引数型既定値
tagstring必須

戻り値:NEMEngine.GameObject[]。

FindWithTag ​

csharp
public static GameObject? FindWithTag(string tag)

指定タグのGameObjectを1つ検索します。

引数型既定値
tagstring必須

戻り値:NEMEngine.GameObject?。

GetBuffer ​

csharp
public DynamicBuffer<T> GetBuffer<T>() where T : unmanaged, IBufferElementData<T>

DynamicBufferはチャンクアドレスを保持せず、各操作で現在位置を再解決する

戻り値:NEMEngine.DynamicBuffer<T>。

GetComponent ​

csharp
public T? GetComponent<T>() where T : class

component / script access 組込みcomponentもMonoBehaviourも同じGetComponent<T>で扱う(Unity準拠) 型カテゴリはComponentKind<T>が一度だけ判定してキャッシュする(hot pathでreflectionしない) 指定componentを返す。未attach / invalidはnull

戻り値:T?。

GetComponentInChildren ​

csharp
public T? GetComponentInChildren<T>(bool includeInactive = false) where T : class

階層を辿る component 取得 firstChild/nextSibling/parent だけで辿る。scriptもcomponentも同じAPIで扱う 自身か子孫から最初に見つかったcomponentを返す。Unityと同じく自身も対象に含める

引数型既定値
includeInactiveboolFalse

戻り値:T?。

GetComponentInParent ​

csharp
public T? GetComponentInParent<T>(bool includeInactive = false) where T : class

自身か祖先から最初に見つかったcomponentを返す。自身も対象に含める

引数型既定値
includeInactiveboolFalse

戻り値:T?。

GetComponents ​

csharp
public T[] GetComponents<T>() where T : class

自身と全子孫のcomponentを集めて返す

戻り値:T[]。

GetComponents ​

csharp
public void GetComponents<T>(List<T> results) where T : class

同じGameObjectにある指定型のComponentをすべて取得します。

引数型既定値
resultsSystem.Collections.Generic.List<T>必須

GetComponentsInChildren ​

csharp
public T[] GetComponentsInChildren<T>(bool includeInactive = false) where T : class

子階層にある指定型のComponentを収集します。

引数型既定値
includeInactiveboolFalse

戻り値:T[]。

GetComponentsInChildren ​

csharp
public void GetComponentsInChildren<T>(bool includeInactive, List<T> results) where T : class

子階層にある指定型のComponentを収集します。

引数型既定値
includeInactivebool必須
resultsSystem.Collections.Generic.List<T>必須

GetComponentsInChildren ​

csharp
public void GetComponentsInChildren<T>(List<T> results) where T : class

子階層にある指定型のComponentを収集します。

引数型既定値
resultsSystem.Collections.Generic.List<T>必須

GetComponentsInParent ​

csharp
public T[] GetComponentsInParent<T>(bool includeInactive = false) where T : class

親階層にある指定型のComponentを収集します。

引数型既定値
includeInactiveboolFalse

戻り値:T[]。

GetComponentsInParent ​

csharp
public void GetComponentsInParent<T>(bool includeInactive, List<T> results) where T : class

親階層にある指定型のComponentを収集します。

引数型既定値
includeInactivebool必須
resultsSystem.Collections.Generic.List<T>必須

GetHashCode ​

csharp
public override int GetHashCode()

同じ値を検索Keyに使うためのHashを返します。

戻り値:int。

HasBuffer ​

csharp
public bool HasBuffer<T>() where T : unmanaged, IBufferElementData<T>

指定型のBufferを所有しているかを取得します。

戻り値:bool。

HasComponent ​

csharp
public bool HasComponent<T>() where T : class

指定componentを持つか。invalid GameObjectは常にfalse

戻り値:bool。

RemoveBuffer ​

csharp
public void RemoveBuffer<T>() where T : unmanaged, IBufferElementData<T>

指定型のBufferを取り除きます。

RemoveComponent ​

csharp
public void RemoveComponent<T>() where T : Component

component削除。同じく遅延適用(missing removeは安全にno-op)

SetActive ​

csharp
public void SetActive(bool active)

GameObject自体のアクティブ状態を変更します。

引数型既定値
activebool必須

SetParent ​

csharp
public void SetParent(GameObject? parent)

親を変更します。worldPositionStaysがある場合はワールド上の配置を保つかを選べます。

引数型既定値
parentNEMEngine.GameObject?必須

TryGetComponent ​

csharp
public bool TryGetComponent<T>(out T component) where T : class

持っていればtrueでoutへ返す。未attachはfalse

引数型既定値
componentOut T必須

戻り値:bool。

activeInHierarchy ​

csharp
public bool activeInHierarchy

親階層も含めて有効かを取得します。

操作:読取専用。

activeSelf ​

csharp
public bool activeSelf

GameObject自体のアクティブ状態です。

操作:読取・変更。

collisionTypeMask ​

csharp
public uint collisionTypeMask

衝突フィルタ用のタイプビットマスク、CollisionComponentが無ければ0

操作:読取・変更。

name ​

csharp
public string name

対象や設定を識別する名前です。

操作:読取・変更。

tag ​

csharp
public string tag

ゲームプレイ用タグから選ぶ

操作:読取・変更。

transform ​

csharp
public Transform transform

所有GameObjectのTransformです。

操作:読取専用。

visibilityLayerMask ​

csharp
public uint visibilityLayerMask

描画カリング用のレイヤーマスク、カメラのcullingMaskと照合される

操作:読取・変更。

実行時の扱い ​

Nativeと接続する操作は、Scriptが実行される有効なWorld内で使用します。破棄したGameObjectやComponentへのアクセスは避けてください。設定Snapshotは取得・編集・反映を1組で扱います。

現行版マニュアル · 8ea58ba2 · 2026-10-28確認