- Home /
FPS Micro Game AI missing reference exception error
Using the FPS Micro Game I tried creating 2 different teams of enemies that fight each other using the included Actor affiliation script. Problem is that when an enemy kills another enemy it throws a missing reference error from the AI script. I assume it's trying to reference the game object it's attacking after the target object has been destroyed. I've tried a couple of different null checks as a solution with no luck. Still throws the error for the same line of code.
If anyone has any idea's, specifically someone with experience with the FPS micro game I sure would appreciate it.
Answer by Mikhailzrick · May 13, 2021 at 09:52 AM
Ok I solved it with some help but it's surprisingly simple. In the code just use gameObject.SetActive(false) and if you want to destroy the game object use Destory(gameObject, "x"); after the SetActive(false). "x" being whatever number you want, or a public float even.
Your answer
Follow this Question
Related Questions
How do I make a FPS Boss? 1 Answer
How do you make a ragdoll blow apart? 1 Answer
How do you make a enemy AI hear approaching footsteps? 2 Answers
FPS TUTORIAL HELP 1 Answer
Gravity Lift/Jump Pad for FPS game 1 Answer