表示テーマ
GameObject
Hierarchyに表示されるGameObjectをC#から操作する参照です。GameObjectの生成・取得・親子付け・破棄を参照してください。
型の情報
- 名前空間:
NEMEngine - 型:
NEMEngine.GameObject(Class) - 継承元:NEMEngine.Object
GameObject
csharp
public GameObject(string name = "GameObject")引数の値で新しいインスタンスを作ります。引数の既定値は宣言を確認してください。
| 引数 | 型 | 既定値 |
|---|---|---|
name | string | GameObject |
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)指定タグと一致するか
| 引数 | 型 | 既定値 |
|---|---|---|
other | string | 必須 |
戻り値: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)
| 引数 | 型 | 既定値 |
|---|---|---|
other | NEMEngine.GameObject? | 必須 |
戻り値:bool。
Find
csharp
public static GameObject? Find(string name)名前を指定してGameObjectを検索します。
| 引数 | 型 | 既定値 |
|---|---|---|
name | string | 必須 |
戻り値:NEMEngine.GameObject?。
FindGameObjectsWithTag
csharp
public static GameObject[] FindGameObjectsWithTag(string tag)指定タグのGameObjectをすべて取得します。
| 引数 | 型 | 既定値 |
|---|---|---|
tag | string | 必須 |
戻り値:NEMEngine.GameObject[]。
FindWithTag
csharp
public static GameObject? FindWithTag(string tag)指定タグのGameObjectを1つ検索します。
| 引数 | 型 | 既定値 |
|---|---|---|
tag | string | 必須 |
戻り値: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 : classcomponent / 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と同じく自身も対象に含める
| 引数 | 型 | 既定値 |
|---|---|---|
includeInactive | bool | False |
戻り値:T?。
GetComponentInParent
csharp
public T? GetComponentInParent<T>(bool includeInactive = false) where T : class自身か祖先から最初に見つかったcomponentを返す。自身も対象に含める
| 引数 | 型 | 既定値 |
|---|---|---|
includeInactive | bool | False |
戻り値: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をすべて取得します。
| 引数 | 型 | 既定値 |
|---|---|---|
results | System.Collections.Generic.List<T> | 必須 |
GetComponentsInChildren
csharp
public T[] GetComponentsInChildren<T>(bool includeInactive = false) where T : class子階層にある指定型のComponentを収集します。
| 引数 | 型 | 既定値 |
|---|---|---|
includeInactive | bool | False |
戻り値:T[]。
GetComponentsInChildren
csharp
public void GetComponentsInChildren<T>(bool includeInactive, List<T> results) where T : class子階層にある指定型のComponentを収集します。
| 引数 | 型 | 既定値 |
|---|---|---|
includeInactive | bool | 必須 |
results | System.Collections.Generic.List<T> | 必須 |
GetComponentsInChildren
csharp
public void GetComponentsInChildren<T>(List<T> results) where T : class子階層にある指定型のComponentを収集します。
| 引数 | 型 | 既定値 |
|---|---|---|
results | System.Collections.Generic.List<T> | 必須 |
GetComponentsInParent
csharp
public T[] GetComponentsInParent<T>(bool includeInactive = false) where T : class親階層にある指定型のComponentを収集します。
| 引数 | 型 | 既定値 |
|---|---|---|
includeInactive | bool | False |
戻り値:T[]。
GetComponentsInParent
csharp
public void GetComponentsInParent<T>(bool includeInactive, List<T> results) where T : class親階層にある指定型のComponentを収集します。
| 引数 | 型 | 既定値 |
|---|---|---|
includeInactive | bool | 必須 |
results | System.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 : Componentcomponent削除。同じく遅延適用(missing removeは安全にno-op)
SetActive
csharp
public void SetActive(bool active)GameObject自体のアクティブ状態を変更します。
| 引数 | 型 | 既定値 |
|---|---|---|
active | bool | 必須 |
SetParent
csharp
public void SetParent(GameObject? parent)親を変更します。worldPositionStaysがある場合はワールド上の配置を保つかを選べます。
| 引数 | 型 | 既定値 |
|---|---|---|
parent | NEMEngine.GameObject? | 必須 |
TryGetComponent
csharp
public bool TryGetComponent<T>(out T component) where T : class持っていればtrueでoutへ返す。未attachはfalse
| 引数 | 型 | 既定値 |
|---|---|---|
component | Out T | 必須 |
戻り値:bool。
activeInHierarchy
csharp
public bool activeInHierarchy親階層も含めて有効かを取得します。
操作:読取専用。
activeSelf
csharp
public bool activeSelfGameObject自体のアクティブ状態です。
操作:読取・変更。
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組で扱います。