0
当我的播放器被破坏时,我想将相机(它是播放器的子对象)拿回层次结构中。但我不知道如何获得层次结构的变换。将相机从Unity中的播放器中移开
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方法的参数。
谢谢,将它设置为空是正确的方式:) – Question3r