How to use isTrigger to spawn enemy with enemyAI script
I don't know If It's ok to post the whole script here because It's quite long. My problem is that I have a functional EnemyAI script. However, when I want to spawn an enemy using trigger, the game crash.
I followed the EnemyAI script from Youtube user here : https://www.youtube.com/watch?v=U1nPbJZ1hlc
And I followed th SpawnTrigger from Youtube user here : https://www.youtube.com/watch?v=xHjwGJIbW60
The error message is this ::
NullReferenceException: Object reference not set to an instance of an object GhostAI.SearchForPlayer () (at Assets/Scripts/GhostAI.cs:72) GhostAI.Update () (at Assets/Scripts/GhostAI.cs:63)
The error in code is this :: if (Vector3.Angle(Vector3.forward, transform.InverseTransformPoint(fpsc.transform.position)) < 60f)
Any suggestion would be appreciated
Your answer
Follow this Question
Related Questions
OnTriggerEnter Not working? 1 Answer
[CODING|2D] Walls that player is able to break through 1 Answer
Need help with OnTriggerExit2D 0 Answers
Need help with physics base enemy AI movement 1 Answer
Checking when two triggers intersect 1 Answer