Answers for "unity c# find gameobject inside gameobject by name"

C#
7

unity find gameobject by name

GameObject enemy = GameObject.Find("enemy");
Posted by: Guest on October-25-2020
0

Gameobject.Find in unityC#

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.
Posted by: Guest on August-28-2021

C# Answers by Framework

Browse Popular Code Answers by Language