The obvious ways are to either:

  • OnTriggerExit for a box collider which wraps the stage bounds
  • OnTriggerEnter for 6 flat box colliders surrounding the stage

I suppose, to start, 6 flat boundaries allow me to differentiate between falling/moving out.

OnTriggerExit could also misfire if a GO is warping to another (disconnected) stage.

But flat boundaries allow for edge cases to occur where the GO moves too fast to trigger the volume, and seem more annoying to set up consistently.

Are there other performance advantages or setup challenges to either approach?

  • \$\begingroup\$ It sounds like you understand the considerations that apply to each (though you can mitigate the risk of missing the outer bound boxes by just making them huge). Which set of pros/cons you prefer is really up to you. \$\endgroup\$
    – DMGregory
    Dec 2, 2021 at 3:41
  • \$\begingroup\$ There is also another option: Make game objects themselves responsible for checking if they are out of bounds. This could be done by a "BoundChecker" component which checks its transform.position in Update and reacts if it's out of bounds. \$\endgroup\$
    – Philipp
    Dec 2, 2021 at 9:38


You must log in to answer this question.

Browse other questions tagged .