FindGameObjectsWithTag() public static method

public static FindGameObjectsWithTag ( string tag ) : UnityEngine.GameObject[]
tag string
return UnityEngine.GameObject[]
Esempio n. 1
0
 private NavMeshAgent MyAgent;  //instantiates a navmeshagent named MyAgent
 // Start is called before the first frame update
 void Start()
 {
     EnemyHealth         = 100;                                                //sets EnemyHealth to 100
     waypoints           = GameObject.FindGameObjectsWithTag("EnemyWayPoint"); // sets waypoint equal to all objects with the tag "EnemyWayPoint"
     MyAgent             = GetComponent <NavMeshAgent>();                      //sets MyAgent equal to this objects NavMeshAgent
     MyAgent.destination = waypoints[CurrentWaypoint].transform.position;      //sets MyAgents destination equal to the waypoint in the CurrentWayPoint position
 }