Replicate AnimInstance derived class?

I am replicating my character across servers, and all of the required properties of my character. These are of various types - UActorComponent and USphereComponent for example. They all replicate perfectly, just as expected.

The animation component is a custom class, derived from UAnimInstance. This is the only property on the character that is NULL when checked for on the clients.

My setup in the header is as follows:

// Player animations
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Replicated, Category = Character)
UCharacterAnimator* Animator;

And in the implementation class, it is included in the list of replicated properties:

    void ARoguelikeCharacter::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
    	DOREPLIFETIME(ARoguelikeCharacter, Details);
    	DOREPLIFETIME(ARoguelikeCharacter, Health);
    	DOREPLIFETIME(ARoguelikeCharacter, States);
    	DOREPLIFETIME(ARoguelikeCharacter, ClassData);
    	DOREPLIFETIME(ARoguelikeCharacter, Statistics);
    	DOREPLIFETIME(ARoguelikeCharacter, Skills);
    	DOREPLIFETIME(ARoguelikeCharacter, Equipment);
    	DOREPLIFETIME(ARoguelikeCharacter, Animator);
    	DOREPLIFETIME(ARoguelikeCharacter, VisionSphere);
    	DOREPLIFETIME(ARoguelikeCharacter, RecentlyStruck);
    	DOREPLIFETIME(ARoguelikeCharacter, IsRolling);
    	DOREPLIFETIME(ARoguelikeCharacter, Stunned);
    	DOREPLIFETIME(ARoguelikeCharacter, IsInCombat);

Everything is replicated, save for this object.

For further clarity, in the constructor of my animation object I am setting bReplicates to true, and all of the properties have the Replicates tag.

Is there any way to replicate a UAnimInstance object? I use it to play animations based on state changes in the character class.

If this is not possible, what alternatives might I have?

You have to replicate property in character blueprint and the AnimBP on both server and Client query state of these replicated properties.
In Paragon they also use a prediction system to change animation properties ahead of time to ease Client/Server animation sync.

Ah, so you’re saying the AnimInstance itself cannot be replicated at all?

That makes things very difficult for me :frowning: My characters call functions on the dervied object. Going to have to refactor an awful lot.

UAnimInstance is a UObject, so it surely is possible. :slight_smile:
Although, you may want to reconsider your approach to the problem.
While I guess anyone has it’s own specific uses for UAnimInstance, it mainly serves the propose of gathering information from your (replicated?) gameplay objects (A character for example) and translate it into animation. (Pretty much what [MENTION=434]BrUnO XaVIeR[/MENTION] said)
Hence why it’s a UObject, not UActorComponent and not AActor. :wink:

I would suggest you replicate all required things in your character class and then retrieve the properties inside the anim instance, thats how i did for my multiplayer project and everything is correctly working on networked situations :slight_smile:

Thanks for the advice, everyone. This will require a major refactor for me but at least I know it cannot be replicated now.