basically i have a script to stream terrains is verry simple
void OnTriggerEnter(Collider col)
{
if (col.tag == "Loader")
{
this.gameObject.transform.GetChild(0).gameObject.SetActive(true);
}
}
void OnTriggerExit(Collider col)
{
if (col.tag == "Loader")
{
this.gameObject.transform.GetChild(0).gameObject.SetActive(false);
}
}
it worked normally but yesterday a random error just pop up:
Destroying GameObjects immediately is not permitted during physics trigger/contact, animation event callbacks or OnValidate. You must use Destroy instead.
UnityEngine.GameObject:SetActive(Boolean)
Streamer:OnTriggerExit(Collider) (at Assets/Scripts/Streamer.cs:18)
the line 18 is :
this.gameObject.transform.GetChild(0).gameObject.SetActive(false);
can someone tell me why is this happening ?