Hi,
I’m here to ask you some questions about ScriptableObjects that i couldn’t find an answer to anywhere.
Let’s say I’m making a Tower Defense Game, so there are several Towers with each their respective Stats. Towers are divided into categories:
- Offensive Towers: yeah pretty self-explanatory lol;
- Support Towers : Towers with no offensive capabilities, but that can boost other Tower’s stats, or make enemies weaker;
- Misc Towers: Towers with none of the above. (Like a tower that makes you money, it doesnt shoot, and it doesnt boost/debuff anything);
And with this, my first thought was to make an Abstract MonoBehaviour, full of general variables that every turret has (for example how much it costs) to represent stats, and then make several other Derived MonoBehaviours for each Tower type that has their respective stats (an Offensive Tower will have his Attack Power, something a Support wouldn’t have).
This, at least in my head, worked fine, but nonetheless i wanted to research a little more on the matter and everything pointed me to these ScriptableObjects.
I’ve studied the basics of how these things work and i can in general understand what they are, why and where are useful… at least, i think??? But i cannot really understand how it links to my case. One of the most “popular(?)” example of their use was of Stats (that being of Enemies, Players, ecc…) which is literally what I’m after. This is somethings i understood:
- Apparently ScriptableObjects are assets, and basically glorified data containers where you can put giant amount of data in it;
- I saw basically everyone say that they are really good at “initializing data” and, if used right, at reducing the Project’s memory usage;
- Someone mentioned that i shouldn’t absolutely change values in them on runtime (which makes sense being an assets);
Now, the problem is that, the stats of my Towers could change on runtime, that’s what Support Tower are made for, but if i cannot change the values of the ScriptableObject on runtime i cannot do that, so some people said that i should create a component that gets every variable from the ScriptableObject and store them there so that i can change them on runtime, but then if i do this i defeat the whole purpose of this and I’m back to square one… see where’s my problem?
I have no idea if I’m missing something really Important because, as of now, i cannot for the life of me understand what I’m supposed to do.
So… I’m asking y’all for a Clarification.
Thanks in advance to anyone that actually reads it.