Here is a flowchart of what im trying to achieve
A list of characters with the same attributes but different stats. What would be the most efficient or recommended way to go about storing this data bare in mind that the characters wont always be instantiated only the current team members and during battle. This is also single player just to clarify.
The first route i thought of taking was an array of a custom class to hold each characters data. The other way was to create an instance script with can be dragged onto each prefab and modified like that? I’m just unsure on which approach to take because I’m going to want to save data to the playerprefs as well as load it.
Any thoughts, ideas or examples are welcome, thanks, Carl.
My immediate impulse is to do something like the following:
GameManager (Persistent gameObject holding the script to handle overall logic)
PlayerHandler (Any logic that pertains to players)
PlayerArray (An array of type `PlayerStats`)
IndividualPlayerStats (A Struct containing the needed stats)
I think a centralized approach is best (and possibly the only practical option) as you don’t have to worry about grabbing components from each character every time you need to update something and when you want to dump it externally it’s all right there for you.
I would make a Character_Basic class with the vitals/stats and functions that all characters will need then make Character_Player, Character_NPC_Allied, Character_NPC_Hostile, and Character_NPC_Neutral all inherit from Character_Basic. Is that what your trying to do?