Endless loop with animation sequence

Setting up a new sequence I get an endless loop here:

SequenceLength == 0.0f
bAllowLooping = false

void UAnimSequenceBase::GetAnimNotifies(const float& StartTime, const float& DeltaTime, const bool bAllowLooping, TArray<const FAnimNotifyEvent *> & OutActiveNotifies) const
	// Early out if we have no notifies
	if( (Notifies.Num() == 0) || (DeltaTime == 0.f) )

	bool const bPlayingBackwards = (DeltaTime < 0.f);
	float PreviousPosition = StartTime;
	float CurrentPosition = StartTime;
	float DesiredDeltaMove = DeltaTime;

		// Disable looping here. Advance to desired position, or beginning / end of animation 
		const ETypeAdvanceAnim AdvanceType = FAnimationRuntime::AdvanceTime(false, DesiredDeltaMove, CurrentPosition, SequenceLength);

		// Verify position assumptions
		check( bPlayingBackwards ? (CurrentPosition <= PreviousPosition) : (CurrentPosition >= PreviousPosition));
		GetAnimNotifiesFromDeltaPositions(PreviousPosition, CurrentPosition, OutActiveNotifies);
		// If we've hit the end of the animation, and we're allowed to loop, keep going.
		if( (AdvanceType == ETAA_Finished) &&  bAllowLooping )

Version 4.7.5

And I mean “Endless LOOP”

Hey theonecalledtom-

Can you check the values of AdvanceType and bAllowLooping during the endless loop? If you run the project in debug mode through Visual Studios and then use Ctrl+Alt+Pause/Break while inside the loop it will act as though a breakpoint was hit and you can then step through the code. This will allow you to check the value of the variables during runtime.


Doug Wilson

I’m not sure how I came to create this crash but I suspect it came from accidentally pulling a zero length sequence into a montage - but my attempts to recreate are failing. Unfortunately I had a fever much of last week and my memory is not great but I suspect that actually AllowLooping was true, the AdvanceType was finished, the sequnce length was zero and it got stuck.

In attempting to recreate I hit another critical error in the same code:

[2015.04.14-16.37.06:728][761]LogWindows: === Critical error: ===
Assertion failed: bPlayingBackwards ? (CurrentPosition <= PreviousPosition) : (CurrentPosition >= PreviousPosition) [File:D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.7\Engine\Source\Runtime\Engine\Private\Animation\AnimSequenceBase.cpp] [Line: 596] 

This is triggered by adding a notify to a new (empty) animation sequence and is different to the original loop.

Repro on second issue:

  1. Go to asset manager
  2. Create new asset
  3. Animation assets → Animation Sequence
  4. Right click on notifies and add particle notify
  5. Crash (for me, 2/2)

Willco - thanks Doug.

For what it’s worth the engineer owning that code could probably spot an endless loop with the info in this thread.

Hey theonecalledtom-

I was able to reproduce the crash when adding the particle notify to the Animation Sequence. This bug has been reported (UE-13800) for further investigation. Let me know if you get any additional information about the first issue or are able to reproduce it.


Doug Wilson