GameObject.FindWithTag Manual     Reference     Scripting  
Scripting > Runtime Classes > GameObject

static function FindWithTag (tag : string) : GameObject


Returns one active GameObject tagged tag. Returns null if no GameObject was found.

Tags must be declared in the tag manager before using them.

// Instantiates respawnPrefab at the location
// of the game object with tag "Respawn"
var respawnPrefab : GameObject;
var respawn = GameObject.FindWithTag ("Respawn");
Instantiate (respawnPrefab, respawn.position, respawn.rotation);