I have an AI that is trying to destroy a target. I have a function called Evade(). If target is null, then perform Evade(). But the problem is when the AI destroys it’s target, the target variable doesn’t become null, it becomes a MissingReferenceException. The Evade() function is never called, and it doesn’t look for a new target. So I need, not only to check if target is null, but if it’s missing. How do I do that? I tried this :
if(!target || target == MissingReferenceException){
Evade();
FindTarget();
}
I get an error saying that it’s not a value, type, variable, or method group. What should I use instead of MissingReferenceException?