Loading function of other script in loading screen

Hi, I want to load the function during the loading time of another script function . How can I do that . I did it with root.findByname but it shows me an error . Need help thanks

Hi @Zillo,

Scene hierarchy and scripts aren’t initialized during loading, so you can’t really access them. What you can do is define a JavaScript global method in any of your scripts, and that you can call. Just note to not try to access any entity in that method:

window.myGlobalMethod = () => {
   // do things

And in your loading script:

1 Like