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?
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.
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.