Writing Custom Actions (C#)
Last updated
Last updated
Other than using , you can write your own via script (C#).
When creating a new class, inherit from Febucci.UI.Actions.ActionScriptableBase
().
Since you’re creating a ScriptableObject, just like Events, make sure to add the needed attributes as well in order to instance and serialize them:
This way you’ll be able to create them from your Project Window.
Then, all you need to do is overriding the “DoAction” method and write your code inside it.
Remember that actions pause the typewriter until they’re completed (for example, waiting for player input or until time has passed).
The action
paramater has useful info about your tag, for example the ID or if there are any parameters that come with it (e.g. <playSound=02>
).
The typewriter
references the component that is currently performing the action
The typingInfo
contains information such as the current typing speed (which you can modify) and time passed inside the typewriter.
Please refer to the Scripting API to have a complete view of the classes and more.
Done! With this simple procedure, you can add any Custom Action you want.
P.S. Don’t forget to create your action ScriptableObject in the ProjectView, and add it to an actions Database.