Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.AI;
- public class IA : MonoBehaviour
- {
- GameObject[] agents;
- // Start is called before the first frame update
- void Start()
- {
- agents = GameObject.FindGameObjectsWithTag("IA");
- }
- void Update() {
- if (Input.GetMouseButtonDown(0)) {
- RaycastHit hit;
- if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 100)) {
- foreach(GameObject a in agents) {
- a.GetComponent<IA>().nma.SetDestination(hit.point);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement