프로그램 공부/Unity 컴포넌트
Transform 관련 스크립트
프로그램 호랭
2023. 12. 31. 01:56
- transform.SetParent(Transform parent)
: 특정 오브젝트를 다른 오브젝트의 하위로 보내는 것
private Transform trans; //A오브젝트의 Transform 컴포넌트
private GameObject obj; //B오브젝트의 GameObject
private void Test()
{
//B오브젝트를 A오브젝트의 하위로 셋팅한다.
obj.transform.SetParent(trans);
}
|