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

static function FindWithTag (tag : String) : GameObject

Description

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

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

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