I know that you are using things from this course as a base for your new game. And was wondering about how the Action system would look scaled up to a bigger project. Would you still keep each action as its own monobehavior even if you are creating lots of actions? or would you offload some of this complexity into a SO to hold the data for each ability and then handle logic from there. I could see breaking actions down into reusable logic like applying damage, targeting type, etc… to be able to handle a bigger system.
Personally, I favor the idea of creating Actions as ScriptableObjects that can be added into an array of actions on the Unity, but this brings with it some extra overhead and record keeping, because ScriptableObjects are shared resources… in other words, setting a variable in the ScriptableObject from one Unit means that it’s set for all Units.
This is generally managed in one of two ways… One is to Instantiate the ScriptableObject at runtime, which gives the SO it’s own sandbox to run in. The other is to have the SO pass around some form of UserData between the methods which keeps track of the current unit data amongst other things.
We cover this in detail in our Shops and Abilities course, part of the RPG series, where Abilities are ScriptableObjects.
My own personal goto for these kinds of scriptable objects is simply
[SerializeField] MyScriptableObject _mySO;
private void Awake()
_mySO = Instantiate(_mySO);