- Home /
Serializable UnityActions
So, to preface this, I understand that what I'm trying to do here is a little unconventional, but I hope that if you read this post, you'll understand my reasoning for doing so.
The context of this is a fairly common one; I'm trying to create a combat system, where I am able to define all the moves a given character can perform as ScriptableObjects. For basic properties such as the move's power or accuracy, this is simple enough. Where I'm struggling is the added effects. Here's how I'm currently implementing it.
The character has some UnityEvents, including one that triggers before a Move being used "PreMove". A Move has a UnityAction of the appropriate type. The UnityAction is (currently) dynamically set to an appropriate Method. That action is then subscribed as a listener of the PreMove UnityEvent, and this all works fine.
What I want to do, is to be able to create a class which contains all the methods for every Move's added effects, and then to set the UnityAction of the Move to one of those methods from the inspector. The issue is that the action does not appear in the inspector, even when assigned the [SerializeField] Attribute. I would like the UnityAction to appear in the inspector of the Scriptable Move Object, and then to be able to set that action to a method define in a script. Is this possible?
Alternatively, if there's a better way of doing this, please let me know.
Your answer
![](https://koobas.hobune.stream/wayback/20220613033751im_/https://answers.unity.com/themes/thub/images/avi.jpg)