Quantcast
Channel: C#タグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 9691

GameObjectがPrefabかどうか判定する

$
0
0
GameObjectがPrefabかどうか(SceneにInstantiateされていないGameObjectであるか)を判定します。 public static bool IsPrefab(this GameObject gameObject) { return !gameObject.scene.IsValid(); } GameObjectがPrefabの場合、GameObject.scene.IsValid()はfalseになります。 UnityEngine.SceneManagement.Sceneはstructなので、IsValidを使用して判定します。

Viewing all articles
Browse latest Browse all 9691

Trending Articles