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"

Replicated Variable sometimes 0

Hi. I'm replicating a int32 called "playing" in my game. However, it sometimes is 0 in Tick, which is really bad since it might cause a delay. I only set it once every few minutes, so I don't understand why it would reset to 0. The server is the one setting the variable.

in cpp

 void AMusicSuiteCharacter::GetLifetimeReplicatedProps(TArray& OutLifetimeProps) const
 {
     Super::GetLifetimeReplicatedProps(OutLifetimeProps);
     DOREPLIFETIME(AMusicSuiteCharacter, playing);
 }
 
 
 void AMusicSuiteCharacter::Tick(float deltaseconds)
 {
     Super::Tick(deltaseconds);
     
         UE_LOG(LogTemp, Warning, TEXT("onegaishimasu: %d "), playing);
 
 }

in header

 UPROPERTY(replicated)
     int32 playing;

any idea how to prevent it from resetting the variable to 0?

Product Version: UE Github Master branch
Tags:
more ▼

asked Apr 01 '16 at 10:30 PM in C++ Programming

avatar image

Leystryku
1 1 1

avatar image Shadowriver Apr 02 '16 at 01:41 AM

Is there diffrence in behavior in client and server?

avatar image Leystryku Apr 02 '16 at 05:19 AM

nope, both seem to do this :c

avatar image Leystryku Apr 04 '16 at 10:47 PM

Did my question get lost in the noise?

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

0 answers: sort voted first
Be the first one to answer this question
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