Is it possible start coroutine in custom action?
I read in this article that yes but finding any example.
https://adventure-creator.fandom.com/wiki/Custom_Actions_-_Part_1
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
The official tutorial on writing custom Actions can be found here.
Coroutines, however, can only be run from MonoBehaviour scripts - i.e. components that are added to GameObjects in the scene. Actions are not MonoBehaviours, and so cannot contain Coroutines.
You can, however, trigger a MonoBehaviour's public functions from an ActionList with either the Object: Call event or Object: Send message Actions.
Actions can internally still run over multiple frames - but they use their own method instead of Coroutines.
An Action's Run function returns how long to wait until it gets called again - provided that you set it's "isRunning" variable to true. If you return "defaultPauseTime", then the Run function will be called again in the next frame. You can keep returning this - and have your Run function be called repeatedly - until some internal "complete" condition is met. To end the Action, you then just need to set "isRunning" to false, and return zero.
For example, this Run function will be called five times and then be considered complete: