UDebugSkelMeshComponent and PreviewInstance are lost current animation asset.
There are 2 ways to fix below
void UDebugSkelMeshComponent::InitAnim(bool bForceReinit) { // If we already have PreviewInstnace and its asset's Skeleton does not match with mesh's Skeleton // then we need to clear it up to avoid an issue if ( PreviewInstance && PreviewInstance->GetCurrentAsset() && SkeletalMesh ) { if ( PreviewInstance->GetCurrentAsset()->GetSkeleton() != SkeletalMesh->Skeleton ) { // if it doesn't match, just clear it PreviewInstance->SetAnimationAsset(NULL); } } #if 0 if (PreviewInstance != nullptr && AnimScriptInstance == PreviewInstance && bForceReinit) #else if (PreviewInstance != nullptr && bForceReinit) #endif { // Reset current animation data AnimationData.PopulateFrom(PreviewInstance); AnimationData.Initialize(PreviewInstance); } Super::InitAnim(bForceReinit);
or
for (UObject* Obj : ObjectsReplaced) { UObject** NewObject = OldToNewInstanceMap.Find(Obj); if (NewObject && *NewObject) { if (UAnimInstance* AnimTree = Cast<UAnimInstance>(*NewObject)) { // Initialising the anim instance isn't enough to correctly set up the skeletal mesh again in a // paused world, need to initialise the skeletal mesh component that contains the anim instance. if (USkeletalMeshComponent* SkelComponent = Cast<USkeletalMeshComponent>(AnimTree->GetOuter())) { // SkelComponent->ClearAnimScriptInstance(); // remove SkelComponent->InitAnim(true); // compile change ignores motion vector, so ignore this. SkelComponent->ClearMotionVector(); } } } }
The easiest workaround is to reopen the preview window and reset the current animation.
Result
A mannequin loses a running animation in animation preview.
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-96266 in the post.
1 |
Component | UE - Anim - Runtime - Anim Blueprints |
---|---|
Affects Versions | 4.22, 4.23, 4.24, 4.25, 5.1 |
Target Fix | 5.1 |
Created | Aug 3, 2020 |
---|---|
Resolved | May 19, 2022 |
Updated | May 28, 2022 |