Global Objects don't update the changes in Preview (Solved)

Hey, So any global object won’t update it’s changes in the preview unless you reset the preview or have a button that resets the scene.

Which is very annoying and makes working slower…

The problem:
1- Open up a preview of a game that has a global object in the scene editor
2- change the position of that object in the scene editor
3- click update preview
4- changes in position won’t appear in the preview unless you restart it or have a button that says go to that scene…

So what’s up with that?
Is it a bug? something intentional in GD?

Waiting for any help on this…

The real question would be:
How make a global object update in the preview without restarting it or restarting the scene?

1 Like

Updating the preview isn’t retroactive. In other words, it doesn’t change anything that already happened. The object was already spawned so updating will not do anything. On the other hand if you had some event that spawns an object at 0,0, then you change it to 200,200 and update, and the event is triggered after the update then you will see it at 200,200

1 Like

@magicsofa
The global object I mentioned, doesn’t have any events, it’s for background and so on…

Also moving a scene object in the scene editor then updating actually changes it’s position in the preview as intended.

But doing the same to a global object only does it if you restart the scene or restart the preview.

I’m talking about the simplest preview update which is changing a global object position in the scene editor.

Not talking about any events…

So why the update works with scene objects but not global unless you do a restart?

I was really skeptical about this because there shouldn’t be any difference with global and regular objects once they’re added to a scene but there is.

I stacked 2 objects of each type so I could track the original positions. G for global. S for scene. I then moved one of the objects. Moving the scene object and then clicking the reload button updated the regular object only.

Original scene

After moving the black version of each in the editor and reloading

This was the updated editor view

I had zero events.

A more extreme before and after refresh or reload. I guess it’s hot reloading. The center is my changed editor.

2 Likes

Keith…Just out of curiosity…since you’re testing…
could you repeat the test using the dedicated OnSceneHotReloaded` inside a custom object?..we may able to track when it happen…

1 Like

@Keith_1357 Yes thank you
That’s exactly what’s happening and I have no idea why, it’s just a simple position change yet it doesn’t update in the preview.

Thank you for explaining the issue so well
I hope you find a solution for this…

I guess you could create a global and scene custom control and see if the OnSceneHotReloaded` is being triggered for both. It’s just really weird because I always assumed the objects were identical once added to a scene.

OK. I made a simple custom object with a text object. I added an 'OnSceneHotReloaded` function that added “Hot Reloaded” to it. I duplicated the extension and then made the copy’s object global.

It appears that global objects aren’t being reloaded. The global is on the left. This is after a reload.

2 Likes

Strange… in the documentation it does say this:

Note that in certain rare cases, GDevelop will be unable to apply your changes to the preview. In this case, a dialog will ask you to close the preview and launch a new one from the beginning.

But it doesn’t mention any difference between global vs scene objects. And it sounds like you didn’t see that dialog anyway

1 Like

Hmm… so i guess we can say that this is a bug in GD ?
Very weird it’s doing that

1 Like

I just wanted to update everyone here that this is indeed was a very hidden bug for a long time and I got in touch with 4ian and it’s officially fixed in version
5.6.266

I want to thank 4ian and the team for fixing this issue, makes working a lot faster and snappier.

Marking this one as “Solved”

Thank you