- Home /
Markers and Signal Emitters not working when Timeline in Manual Update Method ?
Hello,
I have a timeline that has its Update Method as "Manual".
Markers and Signal Emitters are not working, like they are not detected.
If I switch the Timeline Update Method to "Game Time", all works as expected.
Is it a normal behavior ? Or am I missing something ?
Thank you for your help !
Answer by YoannYo · Sep 13, 2019 at 02:14 PM
Ah, that was I was afraid of. Thank you for your answer @seant_unity
Is there something natively designed to have time notifications on a manually updated Timeline ?
Yes, timeline needs to playing (i.e. the engine automatically advancing time) for notifications to fire. This avoids scrubbing causing notifications to fire.
If you need to get around it, here's a method that will fire all notifcations in the advanced range using the manual mode update.
public static void $$anonymous$$anualSetWithNotifications(PlayableDirector director, double time)
{
if (director == null || !director.playableGraph.IsValid() || director.timeUpdate$$anonymous$$ode != DirectorUpdate$$anonymous$$ode.$$anonymous$$anual)
return;
var oldTime = director.time;
director.time = time;
for (int i = 0; i < director.playableGraph.GetOutputCount(); i++)
{
var output = director.playableGraph.GetOutput(i);
var playable = output.GetSourcePlayable().GetInput(i);
var track = output.GetReferenceObject() as TrackAsset;
if (track == null)
continue;
foreach (var m in track.Get$$anonymous$$arkers().OfType<$$anonymous$$arker>())
{
if (!(m is INotification))
continue;
bool fire = (m.time >= oldTime && m.time < time) || (m.time > time && m.time <= oldTime);
if (fire)
output.PushNotification(playable, m as INotification);
}
}
director.Evaluate();
}
Answer by IN_DarrenM · Nov 12, 2020 at 04:05 PM
I know this question was from a while ago, but this was the first hit that shed some light on the issue I was having.
It is possible to get around this limitation if you have the Timeline package embedded in your project, as we have. In TimeNotificationBehaviour.cs the check that stops Signals emitting is at the beginning of TimeNotificationBehaviour.PrepareFrame():
if (info.evaluationType == FrameData.EvaluationType.Evaluate)
{
return;
}
You could either remove this completely, leading to Signals emitting during scrubbing behaviour, or surround in an 'if (!Application.isPlaying)' check to retain the existing scrubbing behaviour but enable Signals when actually playing the game and using manually-updated Timelines.