[SOLVED] Re-creating factory created items with saved ID


#1

I am creating objects on the screen using a factory, saving the id of the object to a table in a different file. I load a different screen, but When I reenter the previous screen I want to use the same ids (with its location) to replace the object in the game

How can I use those factory ids saved to the table to recreate the object in the same place?


#2

If I understand correctly you wish to spawn game objects from a factory and set the id. That is not possible. Can you describe your problem? There is probably a different way to solve this.


#3

You’ll probably need to recreate your objects by creating new objects with the same factory and set your saved positions to them and overwriting new IDs to that table again. IDs shouldn’t matter if you have them updated and stored with the position.


#4

Thanks, thats what I ended up doing. :grinning:


#5

Glad I could help :smiley: if it’s solved, please note it in the topic :wink: