I was wondering, how can I save 2 parameters in the same Script? Like position and rotation, or in the case of my stat scrip, also Stamina.
Basically, I’m trying to save in one script everything for the player GO, that collects position, rotation, health, stamina, and so on, instead of saving just one parameter for each script.
Returning multiple parameters is indeed covered in a later lecture, but I don’t recommend trying to do a mass grab collection of items, as this quickly breaks encapsulation. This can lead to bugs that are extremely difficult to hunt down.
You want health to return heatlh. Health is responsible for maintaining this stat, so should be the sole authority.
You want Mover to return position and rotation.
The SaveableEntity gathers these things together by polling the various ISaveable components, but it should always be up to the component to capture and restore their individual states.