I added a lot of prints
and I realized that when I call the GoToMenu() function from DelayedExecute the variable
scene_
is null, but when I call it from the ui button no.
if(scene_!=null){
Print(“scene != null”);
scene_.RemoveAllChildren();
}else Print(“null scene”);
Output from DelayedExecute:
“null scene”.
Output from ui button:
“scene != null”.
EDIT: I did some tests and it seems that the script loaded by UrhoPlayer is in another angelscript context that the script that calls the function GoToMenu()
Test i made:
https://pastebin.com/4ZTDCT11