Bounding Box culling for 2d games in Unity

Godot has a VisibleOnScreenEnabler2D represents a rectangular region of 2D space. When any part of this region becomes visible on screen or in a viewport, it will emit a [screen_entered] signal, and likewise it will emit a [screen_exited]

3 Questions

  1. Does Unity have a similar component or setting which does not render sprites outside a rectangular region 2D space. or does it have to be created as a Monobehaviour ?

  2. Does a feature like VisibleOnScreenEnabler2D help avoid enemies firing projectiles at player when they are outside the ViewPort bounds ?

  3. Does moving hidden dialogue popups outside the Viewport bounds make any difference in game performance ?

Hi John114,

I think you might be looking for the OnBecameInvisible and the OnBecameVisible methods. In these methods, you could enable/disable things, set flags, or do whatever you need to do. Since the methods are already part of MonoBehaviour, you just have to implement them in your code.

Have you already seen the list with the public methods in the MonoBehaviour class?

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms