How to remove the function from scene.registerBeforeRender

Hello Babylonjs family.

I am creating a fluctuating light intensity effect.
PG - https://www.babylonjs-playground.com/#U5SSCN#269

Now i want to remove this effect on say, a button click.

Please help me out! :sweat_smile: :pray:

You could be using scene.unregisterBeforeRender(func).
I made an example of this
Light intensity Cycles | Babylon.js Playground (babylonjs.com)

Now you can pause or replay the light animation with a click of the mouse

5 Likes

wow… @qq2315137135 , Thanks a lot. :smile: :smile: