I'm writing a Behavior script for some characters that can run actionLists at some points. I'm using actionList.Interact() for that. I would like to implement a way to wait while the ActionList is running. Is there a way to check that directly? Or a way to get the duration of the action list so that I can wait that time?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Depending on need, you can either read the value of actionList.AreActionsRunning() in an Update loop, or hook into the OnEndActionList custom event to run code at the exact moment it ends:
AreActionsRunning() seems ideal, but when I try adding it to my script, it says it doesn't exist. Was that added in a later version? I'm on 1.74.2.
I tried using the OnEndActionList event just like you wrote, but it's not working (it works sometimes, I don't know why). I'm adding the ActionLists to my script as ActionListAssets. I don't if that changes anything.
I added the Debug.Log outside of the if statement to check if the event was called regardless of that. But it's not. Do I need to add anything somewhere else?
The code does seem to be working, but only sometimes. Other times it just straight up does not work.
AreActionsRunning is part of ActionList, i.e. the scene instance.
If you're dealing with an ActionList asset, you can instead read: