Problem with Timeline

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
maymayam32
Posts: 4
Joined: Wed Apr 26, 2023 7:09 am

Problem with Timeline

Post by maymayam32 »

Hi, so I'm trying to implement cutscenes for my game using Timeline. The issue I'm having is that everything seems to work fine when the cutscene gameobject (the one containing the PlayableDirector) is added to the scene manually before I hit play. However, the way I'm trying to use cutscenes is by instantiating a prefab when certain conditions are met and then assigning animators and objects that belong to each track via script. This seems to work fine for animators, but there's a problem with conversation tracks.

I'm using the sequence

Code: Select all

Timeline(speed, Tutorial1, 0);
required Timeline(speed, Tutorial1, 1)@Message(ClosedSubtitle);
to pause the Timeline during dialogues unitl the player clicks continue. But when using the instantiating a prefab method I get the following error

Code: Select all

NullReferenceException: The PlayableGraph is null.
UnityEngine.Playables.PlayableGraph.GetRootPlayableInternal (System.Int32 index) (at <685c48cf8f0b48abb797275c046dda6a>:0)
UnityEngine.Playables.PlayableGraph.GetRootPlayable (System.Int32 index) (at <685c48cf8f0b48abb797275c046dda6a>:0)
PixelCrushers.DialogueSystem.SequencerCommands.SequencerCommandTimeline+<Proceed>d__9.MoveNext () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Options/Timeline/Sequencer/SequencerCommandTimeline.cs:151)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <685c48cf8f0b48abb797275c046dda6a>:0)
and the Timeline just continues playing. Is there a way to fix this?

Thanks in advance!
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Problem with Timeline

Post by Tony Li »

Hi,

That message indicates that, at the point when the Timeline() sequencer command runs, it couldn't find a PlayableDirector component on the GameObject. Please check that the prefab has been fully instantiated before running Timeline(). You might need to wait a little bit, which you could do by using "@" in the sequence, such as:

Code: Select all

Timeline(MyInstantiatedTimeline)@0.1
I don't know if this is any help, but you can also use the Timeline() command to bind GameObjects to a timeline at runtime. Reference: Timeline() sequencer command
maymayam32
Posts: 4
Joined: Wed Apr 26, 2023 7:09 am

Re: Problem with Timeline

Post by maymayam32 »

Ah, very dumb mistake, actually. I'll post this in case anyone ever has the same issue and finds this. So the prefab I'm instantiating is named Tutorial1 and the sequence refers to it as such, but of course, when instantiating it through script it's creating Tutorial1(Clone). Simply using

Code: Select all

Timeline(speed, Tutorial1(Clone), 0);
required Timeline(speed, Tutorial1(Clone), 1)@Message(ClosedSubtitle);
fixed the entire issue.

Thanks so much for the guidance, it actually helped pointing me in the right direction!
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Problem with Timeline

Post by Tony Li »

Glad to help!
DumplingQ
Posts: 10
Joined: Fri Apr 07, 2023 12:02 pm

Re: Problem with Timeline

Post by DumplingQ »

I have reviewed the latest documentation. Does the latest version of the system no longer support TimeLine tracks?
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Problem with Timeline

Post by Tony Li »

Hi,

It certainly does. In the Dialogue System Welcome Window, it the USE_TIMELINE checkbox ticked?
DumplingQ
Posts: 10
Joined: Fri Apr 07, 2023 12:02 pm

Re: Problem with Timeline

Post by DumplingQ »

Oh, What a silly mistake!
Thanks Tony.
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Problem with Timeline

Post by Tony Li »

Glad to help!
Post Reply