| tag | @param tag El tag para buscar. |
Devuelve un GameObject activo etiquetado con tag. Devuelve null si ningún GameObject fue encontrado.
Los tags deben ser declarados en el tag manager antes de ser usados. Una UnityException será lanzada si el tag no existe, o si es ingresada como tag una cadena vacía o con valor null.
var respawnPrefab : GameObject; var respawn: GameObject; // Instantiates respawnPrefab at the location // of the game object with tag "Respawn" // This example assumes that a game object is tagged with "Respawn" function Start() { if (respawn==null) respawn = GameObject.FindWithTag ("Respawn"); Instantiate (respawnPrefab, respawn.transform.position, respawn.transform.rotation); }
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { public GameObject respawnPrefab; public GameObject respawn; void Start() { if (respawn == null) respawn = GameObject.FindWithTag("Respawn"); Instantiate(respawnPrefab, respawn.transform.position, respawn.transform.rotation); } }