After studying the code I think I’ve figured out that it is guaranteed. Bunches (unreal network messages) are sent via UActorChannels. When a new (bReplicates=true) actor is spawned on the server the following happens on the client:
- A
UActorChannelis created with Actor=NULL - The server prepares the initial bunch. An initial bunch contains both the spawn info and initial properties. (See “An ActorChannel bunch looks like this” in ActorChannel.h)
- Each bunch (including the initial bunch) is processed by one call to
UActorChannel::ProcessBunch -
UActorChannel::ProcessBunchdoes (essentially) the following:
if (Actor == NULL) // this is the initial bunch
{
bSpawnedNewActor = true;
Actor = SerializeNewActor(/*...*/); // Calls NewObject<Actor>
}
while (/*...*/)
Replicator->ReceivedBunch(/*...*/); // Read properties and rpcs
if (Actor && bSpawnedNewActor)
Actor->PostNetInit(); // calls BeginPlay
So for the initial bunch all three parts of that code are active. NewObject is called to create the replicated actor, its initial properties are set, then PostNetInit is called on it which calls BeginPlay