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