So, I have a Player and they have a list of ships they customize.
Currently, I'm manually writing the number of ships, and then looping through and for each ship reading/writing the specifics about that ship (which prefab it is, the name, the stats, the color of each material in it).
I was looking to see if I could just save the materials instead, but now I'm wondering if there's a way I can just save a Ship? Or even a Player, that contains an unknown number of Ships?
What is the best practice for storing a Player and all of their ships, and inventory?
Advice on Saving a Player with Ships and Inventory
Re: Advice on Saving a Player with Ships and Inventory
Hi there,
If your ship is represented as a class/script, you can simply save that class. For information on what fields of classes can be serialized, please see this guide:
http://docs.moodkie.com/easy-save-3/es3 ... ted-types/
If your ship is a GameObject, you can find information on saving these here:
https://docs.moodkie.com/easy-save-3/es ... s-prefabs/
All the best,
Joel
If your ship is represented as a class/script, you can simply save that class. For information on what fields of classes can be serialized, please see this guide:
http://docs.moodkie.com/easy-save-3/es3 ... ted-types/
If your ship is a GameObject, you can find information on saving these here:
https://docs.moodkie.com/easy-save-3/es ... s-prefabs/
All the best,
Joel
Re: Advice on Saving a Player with Ships and Inventory
So the Player is a script/class I made, and a Ship is a prefab gameobject with a script that has all of the settings. So, to save a ship, I need to store:
- GameObject or prefab, or at least which Prefab is used
- Materials that may have been changed
- The Class that stores the stats on the ship (speed, turning radius, armor, etc)
These items have not be serialized but are public variables. If I change them all to serialized variables then I can save that class? But you say I can save a GameObject/Prefab. So can I just save the entire GameObject/Prefab to include that Class script that has the stats and the materials that are stored in the GameObject?
I'm a developer by nature, so I'm just a bit confused.
- GameObject or prefab, or at least which Prefab is used
- Materials that may have been changed
- The Class that stores the stats on the ship (speed, turning radius, armor, etc)
These items have not be serialized but are public variables. If I change them all to serialized variables then I can save that class? But you say I can save a GameObject/Prefab. So can I just save the entire GameObject/Prefab to include that Class script that has the stats and the materials that are stored in the GameObject?
I'm a developer by nature, so I'm just a bit confused.
Re: Advice on Saving a Player with Ships and Inventory
You could save the script itself, or the GameObject which contains the script: whichever makes more sense in your project.
All the best,
Joel
All the best,
Joel