Hello, I have 2 Skeletal meshes (Mesh and Mesh2), the first has an animation blueprint set on it through the editor.
I’m trying to set the same animation blueprint to Mesh2 through C++ but I can’t get it to work:
//This gives an error, SetAnimInstanceClass expects UClass?
Mesh2->SetAnimInstanceClass(Mesh->GetAnimInstance());
What’s the proper way to use SetAnimInstanceClass? Mesh2 needs to use the same Animation blueprint as Mesh, is there a way to copy the one from Mesh to Mesh2?
Thanks!
Edit: I’m trying to achieve something similar to this, where Mesh2 is/moves identical to Mesh, and has a ‘shield’ material to look like a shield over the character.
On the C++ part: Mesh->GetAnimInstance() returns the actual object, not the UClass. What USkeletalMeshComponent::SetAnimInstanceClass expects is actually the TSubclassOf< UAnimInstance > or in UAnimInstance::StaticClass()
That being said, I think you are looking for something else though. If I understand you correctly, you want to drive more than one mesh with the same animation data, right? Like a modular Pawn.