I am trying to make a game similar to Total War.
The issue I am having is saving the units and their info.
On my army game object there is an Army manager script with a function that instantiates a chilleded unit prefab that has the unit script on it. The army manager then updates the variables (weapon, unit model, bonuses, etc.) for the unit script.
The question I have is what is the best way to save these instantiated game objects? When instantiated they don’t generate their own unique key. This problem is address in lecture # 86 in the first RPG course but wasn’t sure how to implement. I was thinking of following the idea of making the spawner responsible for the saving of the data.
Currently I add them to a list when instantiated but I think I will have to use a Dictionary to store each unit and all the data that the unit should of had (the particular model, weapon, etc.).
Is there another way?
This is exactly a case where the Spawner should have the SaveableEntity, and your Spawn script should gather all of the components from the spawned object for the purposes of CaptureState/RestoreState
1 Like
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.