0
에서 파괴되면 카메라를 가져 와서 (플레이어의 자식 개체 임) 다시 계층 구조로 가져 가고 싶습니다. 하지만 계층 구조의 변환 방법을 모르겠습니다.내 카메라가 유니티
private void OnCollisionEnter(Collision col)
{
if (col.gameObject.CompareTag("Player")) // player collision with the obstacle
{
ReplaceCamera(); // Take the camera away from the player
Destroy(col.gameObject); // Destroy the player
}
}
void ReplaceCamera()
{
Camera.main.transform.SetParent(?); // Set the camera as a child of the hierarchy
}
ReplaceCamera 메서드의 매개 변수로 전달할 내용을 모르겠습니다.
고맙습니다. null로 설정해 주셔서 감사합니다. :) – Question3r