Forum rules - please read before posting.

Animator Controller, states, transistion and parameters

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.


  • Ok, I've now added a bool parameter and set it to false to run the BathroomSteamAnimation over and over so I now need to know how to change the bool in the action list to play the BathroomSteamFade animation? Any help is much appreciated.
  • Welcome to the community, @Escara.

    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 to host images easily - if you still need help then please try uploading there instead.
  • Hi Chris, thanks for your reply, much appreciated. I understand your instructions however I believe the part I'm stuck on is the setting up of the transition in my Animator for the new animation to play when the parameter's value changes. I've looked at numerous tutorials for this but most concentrate on changing the behavior for a player character where the animations keep looping (I have unticked that checkbox) and not a one off animation. Granted this isn't specifically an AC query and happy to learn a bit of scripting just trying to find the right resource.image
  • A bit more info, once the interaction to turn the taps off and the BathroomSteamFade animation is actioned I don't want either animation to play again. At the moment (even though it's not yet working) it keeps looping to the BathroomSteamAnimation. I'm thinking I need to add another parameter to the transition between Entry and BathroomSteamFade? Or perhaps I'm trying to over complicate it.
  • It shouldn't need any scripting - the transitions should be enough.

    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.
  • Perfect!! It now works as I want it to. So simple when you know how!

    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 :)

  • Thank you, you're welcome! :)
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.