본문 바로가기
Engine/UNITY

유니티 스크립트 - 컴포넌트 삭제하기

by tartist 2016. 8. 4.
GameObject.DestroyImmediate (Target.GetComponentInChildren<Animated_Death>());

 

위 구문은 선택된 타겟 오브젝트의 자식을 뒤져 Animated_Death 라는 컴포넌트를 제거해 주는 명령어 입니다.

GameObject.DestroyImmediate (Target.GetComponent<Animated_Death>());  라고 쓰면 자식이 아닌 본인의 컴포넌트를 제거해 주는 거겠죠~

 

이번에 죽기 관련 스크립트를 수정하면서 알게 된 내용이라 메모해둡니다~