I have a monster that chases NPCs when they enter this trigger. When he kills them, they instantiate a ragdoll and destroy(usual stuff). However, the target variable in inspector has a “missing.”(component, I’m guessing), and this throws me off. Is destruction of an asset not the same as exiting the trigger?
//I don't have my code on me but this is essentially what it says
void OnTriggerEnter(Colider other)
{
if(other.CompareTag("Survivor"))
{
target = other.transform;
}
}
void OnTriggerExit(Colider other)
{
if(other.CompareTag("Survivor"))
{
target = playerTarget;
}
}
I did this check using distance instead of triggers and it worked fine. With this I wanted to use triggers instead of distance for testing.