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"

Initial replication complete event?

Is there a event that is fired when the initial replication of properties and components of an actor is complete?

UE3/UDK had a event called PostInitialReplication or something. Is there a similar counterpart in UE4?

Product Version: UE 4.19
Tags:
more ▼

asked Jul 12 '18 at 10:28 AM in C++ Programming

avatar image

Commander Shepard
772 56 80 214

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

2 answers: sort voted first

I did a small test and here are the findings

BeginPlay is called only after all properties that is inherent to the actor has completed replication. It's safe to use all replicated values in begin play except any pointer to other actors as they may replicate in before or after your actor.

So in BeginPlay its safe to use primitive variables like int,float etc and any subobjects or components that are owned by your actor. Just don't assume other replicated actors to be present whole yours is calling it's begin play

The repnotify functions would be called before begin play but all owned replicated values are valid and safe just like in begin play . If there are more than one repnotifies then their order of callback is not guaranteed but all the values of all repliacted variables are guaranteed to be valid before first repnitify is called.

Ex. Checking replicated float on repnotify or begin play is safe Checking owning controller or a pointer to other replicated actor in begin play is not safe

The engine does something like this

  1. Send all replicated values

  2. Receive all replicated values

  3. Call repnotify for each repnotify variable

  4. Call begin play

more ▼

answered Aug 15 '18 at 06:22 PM

avatar image

Commander Shepard
772 56 80 214

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

As far as I can tell there does not appear to be a signal sent to indicate that everything is initialized. What specific things do you want to wait on before running code? Is it a specific variable state, or do certain components or network objects need to be instantiated first?

What I found was recommendations that you either do this in Tick or on a looping timer and check the specific objects or variables that need replication before running your code, and once those conditions are met (like using ReplicatedUsing and the linked function setting some extra boolean that the variable has been replicated at least once) running your startup code and then canceling the timer. But, it's hard to give specific advice unless you have a more specific situation you want to handle.

more ▼

answered Jul 12 '18 at 04:05 PM

Brian Johnstone (suspended)
(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