Is there some kind of signal I can have an animation controller send that my script can recognize?
So for example when an animation is finished or I reach a certain state, I could have a script recognize that?
I need to trigger certain events in my script that are going to be based off of the animation. If I can’t get something to signal the script that an animation is finished, then I will need to manually find the duration of an animation (or series of animations) and then manually set a timer. It would save a lot of time if I could just get a signal from the AC, or at least recognize what state the AC is in.
Animation Events and/or StateMachineBehaviours should sort you out.
…I can add a script directly to a state?!
This is blowing my mind; there are so major things I could revise in some other projects, but dang it I can’t go back to those right now.
2 Likes
So I’ve been looking into adding these behaviors to states, and they don’t inherit the same qualities as monobehavior. Makes sense; they are not physical objects in the scene.
But as such there are various questions I have about their operation. Like, do I still get a start/awake function? Do these scripts even operate when the state is inactive?
to work, I’m going to need to keep a reference to the other scripts and objects I need them to interact with. Is there an easy way I can have these scripts obtain references? Like, is it possible to have a script on the object assign references to all the scripts on the states? Because I’m thinking: I could have a dozen or so scripts on all the various states, so it wouldn’t be very efficient for each one to be trying to find a reference each time it gets activated…