Unity/기초 예제
유니티 예제_오브젝트의 상태 확인, Activating GameObjects, activeSelf, activeInHierarchy, SetActive()_간단한 예제, 유니티 기초
최애뎡
2021. 4. 18. 15:27
728x90
반응형
첫 번째의 경우 Pcube와 Cube가 모두 활성화
두 번째의 경우 Pcube는 활성화 Cube는 비활성화
세 번째의 경우 Pcube는 비활성화 Cube는 활성화
activeSelf - 스크립트를 적용한 오브젝트의 상태
activeInHierarchy - 스크립트를 적용한 오브젝트의 부모 오브젝트에 영향을 받음
//SetActive - 오브젝트 상태를 변경(bool)
오직 스크립트를 적용한 오브젝트의 상태를 확인할 경우엔 activeSelf
부모 오브젝트의 경우를 대비하여 오브젝트의 상태를 확인할 경우엔 activeInHierarchy
위 글은
Activating GameObjects - Unity Learn
How to handle the active status of GameObjects in the scene, both independently and within Hierarchies, using SetActive and activeSelf / activeInHierarchy. This tutorial is included in the Beginner Scripting project. Previous: Enabling and Disabling GameOb
learn.unity.com
https://unity3d.com/kr/learn/tutorials/topics/scripting/activating-gameobjects?playlist=17117
Unity tutorials을 참고하여 작성했습니다.
반응형