@@ -234,6 +234,7 @@ public void UpdateRootFrame(
234
234
if ( activeCamera != outgoingCamera )
235
235
{
236
236
bool backingOutOfBlend = false ;
237
+ float backingOutPercentCompleted = 0 ;
237
238
float duration = 0 ;
238
239
239
240
// Do we need to create a game-play blend?
@@ -246,6 +247,8 @@ public void UpdateRootFrame(
246
247
{
247
248
// Are we backing out of a blend-in-progress?
248
249
backingOutOfBlend = frame . Source . CamA == activeCamera && frame . Source . CamB == outgoingCamera ;
250
+ if ( backingOutOfBlend && frame . Blend . Duration > kEpsilon )
251
+ backingOutPercentCompleted = frame . Blend . TimeInBlend / frame . Blend . Duration ;
249
252
250
253
frame . Source . CamA = outgoingCamera ;
251
254
frame . Source . BlendCurve = blendDef . BlendCurve ;
@@ -289,11 +292,15 @@ public void UpdateRootFrame(
289
292
if ( backingOutOfBlend )
290
293
{
291
294
snapshot = true ; // always use a snapshot for this to prevent pops
292
- duration = frame . Blend . TimeInBlend ;
295
+ var adjustedDuration = frame . Blend . TimeInBlend ;
293
296
if ( nbs != null )
294
- duration += nbs . Blend . Duration - nbs . Blend . TimeInBlend ;
297
+ adjustedDuration += nbs . Blend . Duration - nbs . Blend . TimeInBlend ;
295
298
else if ( frame . Blend . CamA is SnapshotBlendSource sbs )
296
- duration += sbs . RemainingTimeInBlend ;
299
+ adjustedDuration += sbs . RemainingTimeInBlend ;
300
+
301
+ // In the event that the blend times in the different directions are different,
302
+ // don't make the blend longer than it would otherwise have been
303
+ duration = Mathf . Min ( duration * backingOutPercentCompleted , adjustedDuration ) ;
297
304
}
298
305
299
306
// Chain to existing blend
0 commit comments