x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

AnimInstance Replication

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
 {
     Super::GetLifetimeReplicatedProps(OutLifetimeProps);
 
     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?

Product Version: UE 4.12
Tags:
more ▼

asked May 16 '17 at 09:44 PM in C++ Programming

avatar image

Mesothere
78 8 20 24

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

A pattern I have had success with in the past is to have the AnimaitionBlueprint read variables off it's owner in UpdateAnimation.

In that way, you only need to replicate the owing pawn state.

more ▼

answered May 16 '17 at 09:48 PM

avatar image

OptimisticMonkey
349 7 12 22

avatar image Mesothere May 16 '17 at 10:03 PM

Interesting approach, but I'm not sure it'd work for me :(

I use the C++ object to call functions that dictate the animation logic from my character class and elsewhere. At the moment it's crashing as I'm unable to call those functions, as the object is null.

Is it the case that AnimInstance simply can't be replicated? If so, that's a huge pain for me.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question