게임 오브젝트 활성화

Tutorial

Beginner

+10XP

5 mins

(42)

Unity Technologies

게임 오브젝트 활성화

SetActive와 activeSelf 및 activeInHierarchy를 사용하여 독립적으로, 그리고 계층 구조 내에서 씬의 게임 오브젝트 활성 상태를 처리하는 방법을 알아봅니다.

이 튜토리얼은 스크립팅의 기초 프로젝트에 포함되어 있습니다.

이전: 게임 오브젝트 활성화 및 비활성화

다음: Translate 및 Rotate

1. 게임 오브젝트 활성화

ActiveObjects

using UnityEngine;
using System.Collections;

public class ActiveObjects : MonoBehaviour
{
    void Start ()
    {
        gameObject.SetActive(false);
    }
}

CheckState

using UnityEngine;
using System.Collections;

public class CheckState : MonoBehaviour
{
    public GameObject myObject;
    
    
    void Start ()
    {
        Debug.Log("Active Self: " + myObject.activeSelf);
        Debug.Log("Active in Hierarchy" + myObject.activeInHierarchy);
    }
}

Complete this Tutorial