How is a replicated actor constructed in client?

Assuming we have a replicated actor A in server. One player joins the game and A should be replicated to the client. How is A constructed in client? Is there something like “network construction function” with params corresponding to A’s replicated properties and all the properties are initialized AS A WHOLE inside this function? Or a default object of A’s class is first created, then its properties are changed ONE BY ONE through property replication?

This is some extremely low level stuff, so I’m not sure if anybody would be able to give you a solid answer.

I am guessing there is no network construction function. I think it simply goes through the object list on the server and tells the client to create that object with the replicated values being sent as a whole package (I think this is what the DOREPLIFETIME macros do behind the scenes), but one again I am taking a guess and this could be absolutely incorrect. My reason for saying this is that the constructor on the client gets called. This is why you should do HasAuthority() checks whenever you create a new pointer to a replicated object (or component). The client will set the pointer and then the server will just overwrite it - an unnecessary operation.

Is there a specific context for asking this question or are you just curious?

In some specific cases it does matter. I want to replicate other players’ status (HP, buffs, etc) to a new-come player. Initialization of these status may trigger some visual effects. I’m wondering where to put these trigger code. Will OnRep functions be called right after construction?

Test and find out. I would imagine they would be. OnRep promises it will fire on replication, so I would be severely disappointed if they did not fire on the first replication during construction.