Page 1 of 2

Adding Transition Animations to NPC Subtitle and Response Panel

Posted: Sun May 13, 2018 12:23 pm
by swilliams11
Hi,

I've been playing around with the tool over the past few weeks and am attempting to add transition animations each time the NPC Subtitle is changed, and each time the response panel buttons are changed. I attempted a custom method (script to fade in panels), but it wouldn't quite work out because once the OnClick() method was called, the panels would just be altered and skip the animation.

I've now noticed that there are actually built in options for animation transitions, but I'm struggling to work out how to use them. I've searched through the documentation as much as I can, but can't find much information about them, have I missed the section in the doc?

I've created animations to be used for these, but don't know how to get the states/triggers to actually work with it. Any guidance or link to a place in the doc with a more indepth example would be great.

Thanks!
Sw

Re: Adding Transition Animations to NPC Subtitle and Response Panel

Posted: Sun May 13, 2018 9:16 pm
by Tony Li
Hi,

There's a little section here, but it's not as verbose as it could be. That's something I've addressed in version 2.0, which is in beta testing now.

Your NPC subtitle panel should have an Animator with "Show" and "Hide" animations:

Image

If you're going to allow conversations to run while the game is paused, change the Animator's Update Mode from Normal to Unscaled Time. You may also want to inspect your animation clip(s) and untick the Loop checkbox.

Then inspect the Unity UI Dialogue UI component. Under Dialogue > NPC Subtitle > Animation Transitions, set the Show Trigger to "Show" and the Hide Trigger to "Hide":

Image

If you leave Transition Mode as State, it will treat the values ("Show" and "Hide") as state names, calling Animator.Play() to change states.

If your animation isn't transitioning the way you want, it may be helpful to temporarily tick the Debug checkbox. This will log what the dialogue UI's animator handler is doing behind the scenes.

Re: Adding Transition Animations to NPC Subtitle and Response Panel

Posted: Mon May 14, 2018 1:23 pm
by swilliams11
Thanks for the response Tony. I've tried out what you suggested and it works great for the Show state, but can't seem to work for the Hide state. I get the following message from the debug panel

Code: Select all

Animator.GotoState: State could not be found
UnityEngine.Animator:Play(String)
PixelCrushers.DialogueSystem.<WaitForAnimationState>c__Iterator0:MoveNext() (at Assets/Dialogue System/Scripts/Supplemental/UI/Tools/UIShowHideController.cs:91)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
PixelCrushers.DialogueSystem.UIShowHideController:Hide(String, Action) (at Assets/Dialogue System/Scripts/Supplemental/UI/Tools/UIShowHideController.cs:61)
PixelCrushers.DialogueSystem.UnityUIResponseMenuControls:SetActive(Boolean) (at Assets/Dialogue System/Scripts/Supplemental/UI/Dialogue UI/UnityUIResponseMenuControls.cs:223)
PixelCrushers.DialogueSystem.AbstractUIControls:Hide()
PixelCrushers.DialogueSystem.AbstractDialogueUI:HideResponses()
PixelCrushers.DialogueSystem.UnityUIDialogueUI:HideResponses() (at Assets/Dialogue System/Scripts/Supplemental/UI/Dialogue UI/UnityUIDialogueUI.cs:349)
PixelCrushers.DialogueSystem.ConversationView:SelectResponse(SelectedResponseEventArgs)
PixelCrushers.DialogueSystem.ConversationView:OnSelectedResponse(Object, SelectedResponseEventArgs)
PixelCrushers.DialogueSystem.AbstractDialogueUI:OnClick(Object)
UnityEngine.Component:SendMessage(String, Object, SendMessageOptions)
PixelCrushers.DialogueSystem.UnityUIResponseButton:OnClick() (at Assets/Dialogue System/Scripts/Supplemental/UI/Dialogue UI/UnityUIResponseButton.cs:187)
UnityEngine.EventSystems.EventSystem:Update()
Both of the states are present as far as I can tell, and both work when I switched them about (put the Hide animation to run on show and vice versa, just for testing). Am I missing something?

Thanks

Re: Adding Transition Animations to NPC Subtitle and Response Panel

Posted: Mon May 14, 2018 1:30 pm
by swilliams11
Ah, a slight update. I had the UI visibiltiy set incorrectly. I've now changed it to "Only During Content", and it now plays both animations. However, with a slight update to the core issue I was having, is it possible to get the UI to only hide once the user has selected a response? As it currently runs, the Show animation plays, and then the Hide animation plays directly afterwards. Additionally, when I try to use the same methods on the Response Panel, the given time before the next set of Responses are given doesn't allow for the animation to fully play out. Is there somewhere to edit this?

Thanks again

Re: Adding Transition Animations to NPC Subtitle and Response Panel

Posted: Mon May 14, 2018 2:12 pm
by swilliams11
Once again, I worked away. I see I've made an error in confusing the NPC Subtitle and the NPC Subtitle Reminder. I've now succesfully got the animations playing in the correct places (thank you very much for the guidance).

The last issue/query is regarding delaying the change to the next response/subtitle for the animation to play out fully. Is there a place to alter this?

Thanks!

Re: Adding Transition Animations to NPC Subtitle and Response Panel

Posted: Mon May 14, 2018 3:29 pm
by Tony Li
Hi,

Sorry, I don't quite understand. Have you set a timeout for the response menu? (Dialogue Manager - Display Settings > Input Settings> Response Timeout) If so, can you increase the value by however long it takes to play the animation?

Re: Adding Transition Animations to NPC Subtitle and Response Panel

Posted: Mon May 14, 2018 4:28 pm
by swilliams11
I've not set a timeout for the system. Apologies for the word spaghetti. To illustrate the issue properly here's a video of it happening.



The aim is to get the Subtitle to fade out at the end of one question, and fade back in with the next question. Currently, the 'HideReminder' animation begins to play when it's state is called, however before the animation can finish playing, the next conversation option is input, and the 'ShowReminder' animation of the next question in conversation begins playing.

This can be seen when an option is picked that as the Subtitle begins to fade out, roughly half way through the animation the text changes and the next animation begins.

Re: Adding Transition Animations to NPC Subtitle and Response Panel

Posted: Mon May 14, 2018 5:47 pm
by Tony Li
Thank you. I see what you're talking about now. Currently the response menu tries to jump straight to the next Show. I'll try to have a fix for you by the end of the day.

Re: Adding Transition Animations to NPC Subtitle and Response Panel

Posted: Mon May 14, 2018 8:35 pm
by swilliams11
Thanks very much for the work you're putting in! If it's any help, I've attached a link to the package for my project files

[removed]

Re: Adding Transition Animations to NPC Subtitle and Response Panel

Posted: Mon May 14, 2018 10:15 pm
by Tony Li
Thanks for providing the link. I removed it from the post since it contains some files that shouldn't be made publicly-downloadable, but I have a copy. I still need to iron out an issue. I'm afraid the fix will take until tomorrow.