Reputation: 467
I am running into strange problem with Unity3d's OnBecameInvisible().
As expected this function should be triggered on the Game objects mesh renderer when it leaves the camera bounds but it gets called when i exit the play mode.
Upvotes: 2
Views: 5246
Reputation: 2516
OnBecameInvisible does get called even when you exit play mode. This is as expected because at this point, the Renderers are no longer being rendered by the camera in play mode.
Further, OnBecameInvisible & OnBecameVisible are also called by the scene view camera. Therefore, if your renderer is no longer visible to the play mode camera, it might still be visible to the scene mode camera.
OnBecameInvisible from Unity docs. See the quote below
When running in the editor, scene view cameras will also cause this function to be called.
Upvotes: 5