Hoping someone can help as I'm new to Unity and Animator Controllers,
states, transitions etc. I have a scene
where an animation plays on inception of entering the room. This is the
shower and steam in the room. I have a further animation where the
shower and steam fade. I would like this second animation to only be
triggered when the character turns the taps off. I've attached a screen
shot to illustrate where I currently am. Can someone advise what I need
to do, perhaps adding a parameter to only trigger the second animation
when the specific action is run please? I can then run a cut scene in
the Action List to play it I believe. Many thanks.
Comments
You can use the Object: Animate Action to modify an Animator's parameters. Set the Action's Animation engine to Mecanim, leave the Method as Change Parameter Value, and then fill in the parameter fields that appear beneath. Provided that you've set up the transition in your Animator for the new animation to play when the parameter's value changes, that should cause it to work.
Your image isn't showing up I'm afraid, but know that you can use imgur.com to host images easily - if you still need help then please try uploading there instead.
The one you're showing in the screenshot has the wrong condition - it'll trigger when Switchtofade is false, which is also the default value (set on panel to the left). Change the condition on the right to "true", and make sure that AC's Object: Animate Action also sets the parameter to true when it runs.
You might want to uncheck "Has Exit Time" to have it occur instantly - otherwise it'll loop the first animation until it gets to the point in the timeline where the transition appears in your Inspector.
Also, you have a transition from "Any State" to your steam animation, which might be causing it to play unnecessarily. You can probably remove it since the steam animation will already play by default (it's in yellow).
To save the state of the Animator in your save games, attach the Remember Animator component to it.
Thank you so much for your help on this. AC is truly one amazing bit of kit and makes game development so accessible and most importantly, fun! And the support you provide here is incredible. What a fantastic community this is