LoginSignup
0
2

More than 5 years have passed since last update.

GameObjectの表示非表示

Last updated at Posted at 2019-03-31

GameObjectの表示・非表示についてのメモ

C#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ClaccName : MonoBehaviour {

    GameObject obj;

    // Use this for initialization
    void Start () {
        // シーンのゲームオブジェクトを取得する
        obj = GameObject.Find("Object");
    }

      // Update is called once per frame
      void Update () {
        // ゲームオブジェクトが表示されているかどうかのステータスを取得
        bool isActive;
        isActive = obj.activeSelf;

        // ゲームオブジェクトを表示させる
        obj.SetActive(true);

        // ゲームオブジェクトを非表示にする
        obj.SetActive(false);
    }
}
0
2
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
2