Forum rules - please read before posting.

Animator Controller Parameters to global variables in actionlist

Is there any solution for that, I'd like to put an NPC's (Mecanim) Animation Controller parameter's value to a global variable in an Actionlist, where after I would give back this global variable value to NPC's Animation Controller parameter.

If it possible only with coding, I can't code unfortunately, so if somebody can helps me, I can give gift on Paypal of course.:)))

Thank you for everybody:)

Comments

  • It does involve code - but as I suspect it would be useful to others as well, I've updated the AC wiki with such a script:

    https://adventure-creator.fandom.com/wiki/Link_an_Animator_parameter_to_a_Variable

  • Wao, thank you very much, you're amazing! I check it tomorrow, so I can put parameter's name to a variable and after give back in for example: an cutscene?

  • So long as the Animator is in the scene, yes - when you use a Variable: Check or Variable: Set Action, the parameter and variable values will sync up.

  • I just try to figure out how can I change parameter's name, should I create a string global variable? Sorry Chris, I just need a little help:)

  • You need to create a variable type that matches up with the Animator parameter. If your Animator parameter is a Float, then so too does the Global Variable.

  • Yes, I see. But I would like to check the NPC current parameter name, and after "save" it in a variable and set false, and after give a new parameter (new motion), and after action, I would like to set false the new parameter, and copy from variable the old parameter's name and set true.

    I hope I could write it down, what I try to figure out. I have more situation with NPC, and I don't want to work many with that I set Character: Animation x parameter value false y parameter true and after actionlist again back.:))

  • That does sound different to your first post - the script above allows you to sync up a single parameter with a single variable. If you want to access values and manipulate them yourself, you can still do that - but you'd have to write a dedicated script to do so.

    Through script, you can read/write an Animator's parameter values - see Unity's API on the Animator component here. For more on manipulating AC global variables, see the Manual's "Variable scripting" chapter, as well as the front page of the scripting guide.

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.
Do NOT follow this link or you will be banned from the site!