My conversations are rendered through Unity UI. I see there's a setting for Already Chosen color and highlight, but my button colors are set through animations. How can I link the already chosen setting to a new animation?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
You'll need to rely on scripting, since the exact effect an option being chosen has will be specific to your needs.
You can check if a particular option in the currently-active Conversation has been chosen before with:
Here's a script you can attach to your UI Buttons to update your animation triggers based on this:
You'll need to fill in the Inspectors, and it'll need adapting if you have scrolling in your menu.
Thanks!
Another question. I tried implementing that script and it mostly works. But when I select an option, when the conversation appears again, the button is in its "normal" state and not its "Already Chosen" state. After I highlight it, it switches to its "Already Chosen" state. How can I make it be in the "Already Chosen" state as soon as it appears?
The script should kick in whenever the Conversation appears - check that the Button's Inspector is showing the correct value of "Normal Trigger" in its Animations tab.
It may be that the Trigger itself needs to be run. Try replacing:
with:
That works after selecting an option, but there's a small delay. However, it doesn't work at all when starting a new conversation; the options appear in their "Already Chosen" state and stay that way until I highlight them.
This may be down to how the Animator is set up - the script fires the Animator's "Normal Trigger" when updating the field, but what effect this Trigger parameter has will be down to the transitions set up in your Animator.
Have you created a second "NormalChosen" Trigger parameter and transition in the Animator Controller?
Are you referring to options that were previously set to "Already chosen" from the previous Conversation, or do all options set themselves to "Already chosen" regardless of what came before it?
What are the parameter values set to in a Button component that has this behaviour, at runtime?
I ended changing things up. Instead of having different states for the Already Chosen animations, I converted the existing ones to Blend Trees and had the script set the Blend Tree's parameter to 1 and 0 instead.