Arbitrary animation trigger?

Ony

New member
Forgive me if this is covered elsewhere (I checked!) or obvious, but I would like to be able to trigger any one of a number of looping animations when needed. There are a bunch of them and they will be added to over time.

I think maybe I have to use the abilities system, but that seems to mean I'd have to set multiple action ints, etc. which seems like maybe I'm over thinking things.

Really I just want to have the aforementioned animations in my existing Animator Controller, call any one of those animations by name from script, and have them run while also not allowing any standard UCC locomotion actions until I release the system to do so.

Should I still be looking into the Abilities stuff, or is there some other more straightforward way to do this? On a side note, I've read through the online manual but it's difficult to keep going through it due to it constantly requiring scrolling every time I go to a new section, and I can't seem to find an API. I do appreciate all the work that's gone into this asset. I've owned it since the version before this one, but this is the first time I've actually got around to using it in a game. Just trying to wrap my head around it properly whilst also in a hurry to get up to speed and get back to development.

Thanks!
 
There is a pdf version of the documentation in the unity download (documentation.pdf), which is far friendlier than online searching.

I'd wait for another opinion, but I think you would need the multiple ints and I would likely use an enum in an ability to name all looping animations and have that drive the int in the Animator by overriding int AbilityIntData, which would mean for each animation adding to the enum, a line to that override and a new animation in the Animator with the int, for every case. Using an Ability makes it relatively easy to block player locomotion input too.
 
  • Like
Reactions: Ony
I think maybe I have to use the abilities system, but that seems to mean I'd have to set multiple action ints, etc. which seems like maybe I'm over thinking things.

Really I just want to have the aforementioned animations in my existing Animator Controller, call any one of those animations by name from script, and have them run while also not allowing any standard UCC locomotion actions until I release the system to do so.
@DankP3 has the right approach. The ability system is the way to go, and this sounds really similar to the existing idle ability. When the idle ability starts it'll randomly play any from a set of idle animations within the animator, and it does this based on the AbilityIntData parameter. When you create a new ability you could create a method which has a string parameter that you can then use to determine which animation should play within the animator. If you haven't seen it take a look at this page for an overview of creating new abilities:

 
  • Like
Reactions: Ony
Top