Hi, I am in a little rut with an interesting bug, I cannot seem to get around.
I activate and de-activate an invisible gameobject with an IsTrigger Sphere Collider, that I am trying to use to simulate a fire giving off warmth. and I am able to activate the object when I start the fire, as so my other script can get the OnTriggerEnter needed for Player Collider interaction → where I can simulate the heat effect, but the problem i face is that when I am within the collider, and then I deactivate the collider, although I can see the object has been deactivated in the hierarchy, and my activation deactivation code works as it should, my OnTriggerEnter, OnTriggerExit scripts of which simulate the heat effect still behave as if the collider was present. I.E it doesn’t register that the collider on the gameobject is now no longer present.
Here is the problem code.
[SerializeField]
public GameObject HeatCollider;
void OnTriggerEnter(Collider other)
{
if (gameObject.tag == burningTag && (HeatCollider.activeInHierarchy))
{
isWarming = true;
}
}
void OnTriggerExit(Collider other)
{
if (gameObject.tag == burningTag && (HeatCollider.activeSelf))
{
isWarming = false;
}
}
Any suggestions, I am compelled to create a new code that checks again if object is active, ^^following this but not sure how to go about it.
Again, any help is much appreciated.