Awake or update call

Hello,I m coming from Unity CSharp background,and i m curious to know isn’t there any sort of awake or update command in those babylon scripts,how do they work?Thanks in advance

What is “awake” in the world of Unity?

Pinging a few folks as I will be oof until tuesday

@sebavan / @MackeyK24

There are no direct equivalents for awake and the paradigms are quite different except if you wish to develop with babylon js behavior.

About update, you usually run your own render loop with runRenderLoop and do your updates as you see fit inside of it.

Please note, you also have plenty of observable you could subscribe to to run code at various point of the application.

1 Like

@Deltakosh Sir,Thanks for your reply,Firstly,yesterday I came to know that you are the owner of this amazing Web Tool,U re so humble and honest to your work,I am astonished by your drive,love and passion for babylon.Replying to your question,in Unity awake is called only in start of an application and update is called at every frame.

Thanks for that kind reply,but didnt fully get it
In the examples of the playground section,i didnt see run renderloop any where,but all the code is still running,the code is just written,and there is no mention,when that code is going to run

the render loop in the playground is handle in the playground code itself so to run some code on every frame you can use scene.

First the playground code calls the function createScene from the embedded editor and then runs a simple main loop looking like:

engine.runRenderLoop(() => {

so you can use observables to hook into it Babylon.js Playground

1 Like

I understand,Thanks alot
but plz tell me abt obsevables,heard of them for the first time.

they are just like events in csharp

1 Like

okay,thanks alot,love

If you use the SceneManager extension… you would use script components that have a life cycle…


Are the life cycle functions … kinda like unity itself