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 variable replication

Hello there.

I wonder if is this possible to have replicated variables in classes that derives from AnimInstance?

Here's what I have so far (it doesn't work tho :/)

SoldierAnimInstance.h

 UCLASS()
 class THUNDER2305_API USoldierAnimInstance : public UAnimInstance
 {
     GENERATED_BODY()
 
 public:
 
     UPROPERTY(Replicated)
     float CachedYaw;
 
     virtual void NativeUpdateAnimation(float DeltaSeconds) override;
 }

SoldierAnimInstance.cpp

 USoldierAnimInstance::USoldierAnimInstance()
 {    
     CachedYaw = -1.f;
 }
 
 void USoldierAnimInstance::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
 {
     Super::GetLifetimeReplicatedProps(OutLifetimeProps);
 
     DOREPLIFETIME(USoldierAnimInstance, CachedYaw);
 }
 
 void USoldierAnimInstance::NativeUpdateAnimation(float DeltaSeconds)
 {
     if (TryGetPawnOwner() && TryGetPawnOwner()->Role >= ROLE_Authority)
     {
         CachedYaw = 5.f;
     }
     
     Super::NativeUpdateAnimation(DeltaSeconds);
 }

Any ideas why this doesn't work and how to fix that? Btw. UE4.8.1 here.

Thanks in advance.

Product Version: UE 4.8
Tags:
more ▼

asked Jul 11 '15 at 02:28 PM in C++ Programming

avatar image

Atheist91
1.1k 18 22 38

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

I think I've found an answer here. :/

The first class in the UObject class hierarchy that implements replication is AActor. All game relevant objects that you wish to be shared between server and clients have to be Actors.

more ▼

answered Jul 11 '15 at 07:09 PM

avatar image

Atheist91
1.1k 18 22 38

avatar image DaneBrick Jan 28 '19 at 12:32 AM

UAnimInstance is a subclass of UObject

(comments are locked)
10|2000 characters needed characters left
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