Forum rules - please read before posting.

Expression tags having no effect on mecanim

Hello!
I'm trying to use mecanim expressions, but I'm not getting results. To be concrete: I've checked "Use expressions?", and I've given Expression #0 the name "Laughter" and Expression #1 the name "Anger". I've set Expression ID integer to "Expression" and created a parameter in my animator controller named "Expression". My assumption is then that a line like "[expression:Anger]To be or not to be. [expression:Laughter]That is the question." would set the parameter "Expression" to value 1 at the beginning then to value 0 in the middle.

Instead, I'm not observing the expression tags to have any effect on the parameter. The parameter is set to 0 upon beginning any dialog, whether or not it has tags. In dialogues with expression tags, the tag behaves as "[wait]" is documented to behave. Any ideas on this double misbehavior? (It seemed odd that I didn't have to set anything inside the "Mecanim parameters" section of my player)

Cheers and thank you!

Comments

  • The "Expression ID integer" field should be up in the Mecanim parameters box, you're right.

    As for the main issue, this looks like a bug.  Not clear if it's a result of Unity updates yet, but I will address it for v1.51.  Thanks for the report.
  • Sorry - I was being dense.  Followed your steps myself, and I can't recreate the issue.  So long as the Mecanim parameter's name matches that of the Expression ID integer field, it should work.  You're using scrolling speech, I take it?

    I don't know if you're script-inclined and don't mind debugging, but the Char script function GetExpressionID (string expressionLabel) is what converts the expression tag into an ID number.
  • Very script inclined! I'm a Unity newb, and discovering I had access to all the code running everything just made everything about AdventureCreator awesome and waaaay easier to understand! :D :D (very clear and readable code, thanks so much!)

    Figured the problem: I was doing everything "right", but every time Speech.cs#_FixedUpdate() runs, it sets the expression to the next expression in the speech line (L378 in the code), and (I don't fully understand the lifecycle of when it gets called) it gets called constantly. This means that if you have many expressions in a speech line, the mecanim parameter will actually get set to each id in turn, but it happens extremely quickly at the beginning of the line, so you can only observe the final value.

    tl;dr is that if you have multiple expressions in a line, only the final one is used. Because I was ending every line with returning the character to the default expression, only the default expression was every seen.

    Is this a bug? It doesn't seem like it would be expected behavior? What's the expected way to have different emotions during a line, or even to go back to the default expression after a line?

    Really appreciate the help! :D
  • edited March 2016
    That line of code is running because the speech is not scrolling - an option you can enable in the Speech Manager.  With scrolling, the Speech script processes the text one character at a time at the rate you set.  Without scrolling, it's all done in an instant - so only the last-found expression tag will have any visible effect.

    If you want to make use of per-character processing without the visible effect of scrolling, you'll want to grab the upcoming v1.51 update.  It will provide event listeners for (amongst other things) speech initialisation - so you could feasibly write a very simple script that displays your own Label / UI Text component will the full speech text, rather than AC's one which will scroll one character at a time.
  • Ah, gotcha. I'd like to avoid the visible scrolling effect. I'll see how reasonable it is to have one emotion per line/I'll investigate 1.51! Thanks so much, you were very helpful!!
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.