Removing event's callback

Hello,
I am trying to understand how I can remove a callback.

In the playground below, I have a simple example where I load a mesh, add a callback to check to check visibility, and then in 5 seconds, I am removing the callback (lines 10-26). However, after my “remove” call, I see in the console that the callback still prints out messages

Please let me know how I can remove callbacks
Thank you

I have some work-around - I can call
onBeforeCameraRenderObservable.clear()
But, I believe that clears everything

This would do it https://playground.babylonjs.com/#C880RB#1 you need to remove the observer created in the add function

1 Like

@sebavan Thank you! That works great!