Call ontriggerenter not as often?

Is there anyway to have collision detection every second instead of every frame. My game is lagging whenever there are too many enemies, because it calls ontriggerenter every frame.

Erm.... OnTriggerEnter should be called when something enters a trigger, and should only only be called once, unless it leaves the trigger and re-enters.

What are you using it for? What exactly enters the trigger each frame?

You might get some unwanted collisions that can be avoided by using Physics.IgnoreCollision. Check out the example they give on that page for an idea on where to use it.

the function OnTriggerEnter will be checked for every frame. Unity will look if there is collision between the gameObject the script is attached to and another Collider. However if there is nothing colliding that part of the script will just be skipped.

If it is a parent useing the ingorecollision will all children colliders be ignored? veryhungryhobo Aug 11 at 18:34

Not really sure. But i think it would make the most sence if they would be ignored.

Grtz BallzOfSteel