Page 1 of 1

Problem with Timeline

Posted: Tue May 02, 2023 5:17 am
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!

Re: Problem with Timeline

Posted: Tue May 02, 2023 8:48 am
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

Re: Problem with Timeline

Posted: Wed May 03, 2023 4:21 am
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!

Re: Problem with Timeline

Posted: Wed May 03, 2023 8:35 am
by Tony Li
Glad to help!

Re: Problem with Timeline

Posted: Mon May 15, 2023 9:26 am
by DumplingQ
I have reviewed the latest documentation. Does the latest version of the system no longer support TimeLine tracks?

Re: Problem with Timeline

Posted: Mon May 15, 2023 9:30 am
by Tony Li
Hi,

It certainly does. In the Dialogue System Welcome Window, it the USE_TIMELINE checkbox ticked?

Re: Problem with Timeline

Posted: Mon May 15, 2023 11:40 am
by DumplingQ
Oh, What a silly mistake!
Thanks Tony.

Re: Problem with Timeline

Posted: Mon May 15, 2023 1:16 pm
by Tony Li
Glad to help!