Gdevelop: Web requests freeze scenes

Created on 22 Aug 2020  路  4Comments  路  Source: 4ian/GDevelop

Describe the bug

When I send a web request, the current scene freezes until the request ends (some seconds).

To Reproduce

Add a web request action in a scene and test.

https://giusreds.github.io/molise-run

In my game, it appens in the main menu, where I use web request to provide highscores... Test yourself trying the link above...

馃悰 bug 馃憣good first issue 馃Breaking change

Most helpful comment

Requests are for now (sadly) synchronous. This was an old decision that was not right. I'll make a new action that is sending an asynchronous request (response stored in a scene variable).

All 4 comments

I'm going to wait for one of the contributors to respond to confirm, but I believe this is how web requests are supposed to work.

Requests are for now (sadly) synchronous. This was an old decision that was not right. I'll make a new action that is sending an asynchronous request (response stored in a scene variable).

I found a workaround, sending the xHttp request in a JavaScript block, as asynchronous.

This is a proper workaround, glad you could unblock you :) Next version of GDevelop will have an updated action that is not blocking the game, and storing the result in a variable when done (or in an "error" variable in case of error in the request).

Was this page helpful?
0 / 5 - 0 ratings