I was just wondering if it was possible to have a SaveData class with the struct in there to reuse for other classes instead of creating a struct for each class like mover, health etc…?
thanks
I was just wondering if it was possible to have a SaveData class with the struct in there to reuse for other classes instead of creating a struct for each class like mover, health etc…?
thanks
You can do exactly that, as long as the struct has the [Serializable]
attribute. The SerializableVector3 is an example of just a struct that could be used in any of the ISaveable classes.
If you are using the Json Saving System, then a better approach is to construct JObjects within CaptureState with the relevant Data and restore by extracting from those JObjects.