본문 바로가기

unity tech.

컴포넌트 찾는 예들

Renderer[] list = gameObject.GetComponentsInChildren<Renderer>();


TextMesh[] textMeshes = FindObjectsOfType<TextMesh>();


BoxCollider box = FindObjectOfType<BoxCollider>();


Transform voice = item.transform.FindChild("VoiceTextMesh");
TextMesh voiceTextMesh = voice.gameObject.GetComponent<TextMesh>();


Text voiceText = voiceImg.GetComponentInChildren<Text>();


Image itemImg = itemRect.FindChild("itemBox").gameObject.GetComponent<Image>();