Problem changing scene with angelscript

Hi, I’m trying to delete the scene and load the main menu when I click. The problem is that nothing happens when i click.
PS: I tried to do the same thing from a button on ui and it works.



How do I set another Scene?

1 Like

Still not working :confused:
This line is not begin executed:


I also tried:

File loadFile(fileSystem.programDir + “Data/Scenes/empty.xml”, FILE_READ); //clear scene

Add more print statements, make every other line a print statement indicating the next call, and with the last one being “Finished GoToMenu.” This will make sure you’re not crashing the angelscript context somewhere.

If your original “Creating Menu (:” message prints in both cases then something is happening somewhere, and you need to narrow it down.

1 Like

I added a lot of prints :stuck_out_tongue: 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.

Print(“scene != null”);
}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():confused:

Test i made:

Fixed in the worst possible way i think. (:
I added this line to HandleUpdate:


Then when i have to call GoToMenu(); i just do:


Couldn’t you store that in a boolean?

No, it seems that when I use #include from a scriptinstance it creates a new context or something like that.

This doesn’t sound right. The context shouldn’t be the problem, script-module might be, but I still wouldn’t expect that here.

Is your project small enough to post? If not I have a reasonably small delta for adding asPEEK debugging that might work (you can use the web-based debugger, or I have a full IDE for Angelscript). It was never and probably never will be merged due to instability (it’ll time out randomly and can sometimes jam things up while running … it’s better than nothing though).

My project has more than 40 script files. I’m going to write a minimal example (only 2 script files).
Tomorrow I upload the files. :slight_smile:

Scripts: ( (

Scene: (scene.xml)

Urho3DPlayer.exe Scripts/