August 2018
Beginner
334 pages
10h 19m
English
We will create a component that is able to see enemies nearby:
using UnityEngine;
using System.Collections;
public class Visor : MonoBehaviour
{
public string tagWall = "Wall";
public string tagTarget = "Enemy";
public GameObject agent;
}
void Start()
{
if (agent == null)
agent = gameObject;
}
public void OnTriggerStay(Collider coll)
{
// next steps here
}
string tag ...
Read now
Unlock full access