📜  Gameobject.Find in unityC# 代码示例

📅  最后修改于: 2022-03-11 14:48:58.297000             🧑  作者: Mango

代码示例1
GameObject sphere = Gameobject.Find("Player");
// above code will search whole scene for the gameobject named "Player"
//
GameObject sphere = Gameobject.Find("/Player"); 
//above code will search the gameobject named "Player" but this gameobject cannot be a child

GameObject sphere = Gameobject.Find("/player/gun");
//above code will search the gun gameobject which must be the child of Player 
// and player must not be the child of any other.