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"

Unreal GameState not replicating Variables

I am using GameState to store the positions of players in an array however they have stopped working in multiplayer bellow is the code and the output

 UPROPERTY(EditAnywhere, BlueprintReadWrite, replicated)
         TArray<FString> CarNames;
 
 void ARacingGameState::GetLifetimeReplicatedProps(TArray< FLifetimeProperty > & OutLifetimeProps) const
 {
     Super::GetLifetimeReplicatedProps(OutLifetimeProps);
     DOREPLIFETIME(ARacingGameState, Timer);
     DOREPLIFETIME(ARacingGameState, FinishedCars);
     DOREPLIFETIME(ARacingGameState, GameState);
     DOREPLIFETIME(ARacingGameState, NumLaps);
     DOREPLIFETIME(ARacingGameState, CarNames);
     DOREPLIFETIME(ARacingGameState, PlayersCompleted);
 }

however the variables in the array do not update to the clients this is the log if I print the array at index 1

 Server: DESKTOP-BSGU652-E38A
 Client -2: DESKTOP-BSGU652-C5E9
 Client -2: DESKTOP-BSGU652-C5E9

Any idea what may be causing this? Has anyone seen this before?

Product Version: UE 4.19
Tags:
more ▼

asked Jul 10 '18 at 11:13 AM in Using UE4

avatar image

Taikatou
138 3 5 13

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

1 answer: sort voted first

It might be that the Replicated tag on the variable in the UPROPERTY block needs to be capitalized. If that is a copy-paste from your code then try just changing that first and see if it fixes it.

more ▼

answered Jul 10 '18 at 03:17 PM

Brian Johnstone (suspended)
avatar image Taikatou Jul 10 '18 at 04:17 PM

I tried that at first, but to no avail I have removed the replicated variables from the system it was easier than fixing it

(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