LoginSignup
0
1

More than 3 years have passed since last update.

Unityの条件分岐色々※随時更新

Last updated at Posted at 2020-10-14

ゲームオブジェクトがアクティブかどうか

GameObject.activeSelf を使う。
activeSelf は、ゲームオブジェクトのアクティブ状態を読み取る専用のメソッド。
参考: GameObject-activeSelf - Unity スクリプトリファレンス

if(A.activeSelf == true)
{
  Debug.Log("Aがアクティブな場合表示される");
}

アクティブ状態に関するメソッドに、SetActive が存在するが、こちらはアクティブ状態の切り替えに使用されるため、アクティブ状態を利用した条件分岐には使えない。

// NG例
if(A.SetActive == true)
{
}
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1