Timeline Clip QOL Suggestion

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Jamez0r
Posts: 59
Joined: Fri Nov 20, 2020 8:18 pm

Timeline Clip QOL Suggestion

Post by Jamez0r »

Preface - I am using Dialogue System v2.2.13, so I apologize if this change has already been made :lol:

--

Hey Tony! I've been doing a lot of stuff with Timeline recently, and today I wanted to create a custom Track for controlling a Conversation.

I found the existing "Conversation Track" and "Continue Conversation Track" and they were amazing references for what I wanted to set up.

As I was looking through their code, I noticed that for the Continue Conversation Track, you had to have the gameobject with the PlayableDirector selected in the Hierarchy for the PreviewUI (in editor mode) to determine the correct dialogue message to display.

The reasoning seemed to be the need to reference the PlayableDirector, in the function GetEditorContinueText on the ConversationContinueMixerBehaviour:

Code: Select all

 var go = UnityEditor.Selection.activeGameObject;
            if (go != null)
            {
                var director = go.GetComponent<PlayableDirector>();
                if (director == null) director = GameObject.FindObjectOfType<PlayableDirector>();
                if (director == null) Debug.Log("Select PlayableDirector GameObject to be able to preview bark clip text.");
                if (director != null && director.playableAsset != null)
                { ...
I believe all of this can be replaced with:

Code: Select all

PlayableDirector director = playable.GetGraph().GetResolver() as PlayableDirector;
            if (director != null && director.playableAsset != null) {
            ...
Which makes it so you don't have to have the gameobject with the PlayableDirector selected in the Hierarchy when you're previewing. Pretty handy! :mrgreen:
User avatar
Tony Li
Posts: 21985
Joined: Thu Jul 18, 2013 1:27 pm

Re: Timeline Clip QOL Suggestion

Post by Tony Li »

Hi,

Thanks! I'll test that out and add it in the next release.
Post Reply