Hello, I have an action list with a certain dialogue that is several lines long. I would like the NPC that is speaking to go through different 3D animations while the text is spoken, something like:
Lorem ipsum dolor sit amet (happy), consectetur adipiscing elit. (idle)
Quisque quis aliquet ex. (angry) Donec tincidunt id nisl vitae eleifend. (idle)
Phasellus (crying) blandit enim ullamcorper odio faucibus dapibus.
I saw on the manual that it can be done with expressions apparently, but not with animations. Is it possible by creating a custom token? I didn't really understand that part well.
Another solution for this might be to have the text's sentences in separate actionlist nodes while having then remain on screen for a similar long paragraph effect, but when I tried using [hold] it just overlapped the new dialogue on top of the previous line.
I'm very new to AC so I'm not sure if there's anything else I haven't tried. Thanks in advance~
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Welcome to the community, @nastenka.
Separating your speech into separate lines is possible - just check Play in background? to have an ActionList continue on without waiting for a speech line to finish - but if timing is important then it'll be tricky to get your animations to sync up this way.
Custom speech tokens are indeed a good way to get around this. You can have a script, for example, that creates an "anim" token which invokes a Trigger parameter on the character's Animator.
For example:
This script would invoke Triggers named happy, idle, angry and crying with the altered speech text being:
Personally, however, I prefer to use Unity's Timeline feature whenever timing is important. AC has its own Speech track that you can use to play dialogue, and this can be used alongisde Unity's Animation track to have animation and speech play together. The tokens method above may be more suitable for your own use-case, but for completeness, a video on using AC with Timeline can be found here.
Hi @ChrisIceBox , thank you!
I'm not sure if I'm doing something wrong but this has the same effect as the [hold] had, the dialogue remained there but the next one just overlapped right on top. Do I have to go into Unity UI to fix that? I will have to eventually but as of now I have no idea how.
My Unity and coding knowledge is very small and I don't really understand how I would go about implementing that code solution either (I guess I could copy and paste it somewhere but idk where or how to implement those animation triggers). On the other hand, I started watching the timeline tutorial and it does seem like the most straightforward way, so I'll see how it goes with that. Thanks a lot (ᵔᴥᵔ)
Try unchecking Duplicate for each line? in the Subtitles menu's properties.
Copy/paste the script into a C# file named CustomSpeechTokens and attach it to an empty GameObject in the scene.
The script relies on Triggers, but that's just an example. To implement Triggers, create a Trigger parameter in your character's Animator Controller - inside the Animator window - of the same name as your token's value ("happy", "idle" etc). These Triggers will then be invoked when the dialogue reaches the tokens.
Yes, Timeline's a great option when you want to synchronise multiple animations and/or speech.