Download

Montage_SetEndDelegate bug when run from client?

Hello guys,

I have some fairly simple logic to run animations. I run them from C++, and when the animation ends, I like to run a simple function to set some variables.

It looks roughly like this:


    
character->GetMesh()->GetAnimInstance()->Montage_Play(animName, speed);

    FOnMontageEnded MontageBlendOutDelegate;    
    MontageBlendOutDelegate.BindUObject(this, &UCharacterAnimationManager::AnimationEnded);

    character->GetMesh()->GetAnimInstance()->Montage_SetEndDelegate(MontageBlendOutDelegate);


Although this is a minor simplification for ease of reading.

This does play the animation fine. On the server, the animation plays as expected - if I put a breakpoint in the AnimationEnded function then it occurs when expected (that is, after the animation has ended) - on the client however, the same logic doesn’t take place - the animation plays as expected, but the AnimationEnded function is immediately called at the same time as play, despite the animation clearly not being finished with.

Is this a bug, or am I missing something in the implementation?

Interestingly, the same happens for the blend out delegate. Always called prematurely on clients, immediately after the animation starts - but not on the server.