기억 저장소 😎

  • 홈
  • 태그
  • 백준

Parent Object Unity 1

[Unity] 특정 Object의 자식 Object들 제거법

void DestoryChild(GameObject parentObject) { Transform[] childList = parentObject.GetComponentsInChildren(true); if (childList != null) { for (int i = 1; i < childList.Length; i++) { if (childList[i] != transform) Destroy(childList[i].gameObject); } } } 위 함수처럼 작성을 하면 parentObject의 자식 오브젝트들을 모두 제거해준다. 여기서 for 문 내의 i값을 0이 아닌 1부터 시작하는 이유는 childList[0]에는 parentObject가 담겨있기 때문이다.

Unity 2021.03.30
1
더보기
프로필사진

  • 프로그래밍 공부 (90)
    • 같은 삽질은 없다! (5)
    • Python (3)
    • 백준 (38)
    • 흥미진진한 자료구조 (0)
    • 재밌는 알고리즘 (2)
    • Unity (19)
    • 끄적끄적 (7)
    • 헷갈리는 개념 (2)
    • 운영체제 (1)
    • CodeGround (2)
    • 인공지능 (10)
    • 컴퓨터 그래픽스 (0)

Tag

Visual Studio 주석, 유니티 프로파일링, Visual Studio 주석 단축키, unity hp bar, Unity, Rider 여러 줄 주석이 안될 때, 유니티 프로파일러, Unity Rider 주석 단축키 안될 때, 유니티 최적화, Unity 3d object 2d canvas, Unity Profiling, Unity nickname, Make sure USB debugging, Scripting API, Unity Profiler, 2d canvas, c#, RequireComponent, Unity HP, Unity 최적화,

최근글과 인기글

  • 최근글
  • 인기글

최근댓글

공지사항

페이스북 트위터 플러그인

  • Facebook
  • Twitter

Archives

Calendar

«   2025/12   »
일 월 화 수 목 금 토
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31

방문자수Total

  • Today :
  • Yesterday :

Copyright © Kakao Corp. All rights reserved.

티스토리툴바