Global object instances not independent in scenes

I have created global objects. I place them in scene 1 in a particular x and y location. I then go to scene 2 and add new instances from the global objects into the scene. I place them in different x and y locations. When I go back to scene 1, the global object instances have moved to match the locations of them in scene 2. If I move an instance of a global object in one scene, it moves it in all my scenes.

Any ideas why this is happening? Need help or I will have to stop using global objects and will be forced to create the same object in every scene.

I cannot reproduce it.
Does it only happen in your project or also in an empty one and in the platformer example?

It does not happen in the platformer game or a new empty project. It only happens when I use a global text object and only in my current project. If I move the object instance in one scene it moves it in the other scene. Weird. Can’t figure it out. I am going to see if I can replicate it in another project. If not, I will just create separate text objects in each scene for the game I am working on…

Is your 2nd scene a duplicate of the first?

Yes it is a duplicate.

It might be that, really not sure. But, has happened to me. Try copy pasting the scene

2 Likes

Ok. Thanks. I also found out that if you duplicate an object, it will do the same thing. For instance, I made an object and used piskel to color the square object red. I then duplicated the red object and changed the color of the new object to yellow in the piskel editor. It changed the color of the red object to yellow. I am guessing all this ties into the duplication process whether it is a global object or a regular object. I just have to recreate each object as new objects instead of using the duplication feature of GDevelop. Hopefully, someone can take a look at this and get it fixed.

2 Likes

I have a similar issue.

  • I duplicate an object (clicking on the 3 dots and selecting duplicate)

  • The duplicated object is assigned a different name

  • I edit the new duplicated object with Piskel

  • I save the changes

  • I get this weird result: both the original object and the duplicated one are changed

  • I tried also to close and reopen Gdevelop to check if it was a kind of memory buffer bug, but I got the same result

  • It looks a bug, because it makes duplication of objects useless. But more interesting question is: how the two objects remain “connected”, since there’s no visible variable or property connecting them

If you look closely at the duplicated objects (at least in the case of sprites) you’ll notice that they share images. That’s the reason if you duplicate an object and edit the image you’ll see the undesired effect of changing one’s images also affecting the others. Gdevelop forces a rename of the object but it doesn’t force a rename of the object’s images.

It might be a viable solution to force the renaming of all the images of a copied object; however, it could lead to problems down the road. It’s more efficient for objects to share images when possible, and duplicating/renaming a bunch of images could lead to bloat in the long term. I had the same frustration when learning GDevelop until I figured out what was happening and took more care when duplicating objects, but I don’t know what is the best solution; I’ll leave that in the hands of the devs.

Regarding the duplicated text objects moving in different scenes, that sounds a little more like a bug, but I’ve not been able to reproduce it.

Thanks for the comment.
I found this workaround.

  • Duplicate object
  • Find the name of the png file images of the original object
  • Duplicate the image files (e.g. adding “_2” in the end)
  • Edit the duplicated object. Delete the images and add the renamed ones
1 Like