How are pointers to UOBJECT replicated under the hood?

How are pointers to UOBJECT replicated on a technical level when used either as a replicated variable or as a parameter to an RPC?

Does UE4 only transmit id of the object and client find its own version? Or is the pointer internally de-referenced and all properties are serialised and sent?

For example say I am making an RPC call from client to server with UAnimMontage* as parameter what happens then?

A. Under the hood a unique identifier/number for the UAnimMontage asset is sent as parameter and then server finds UAnimMontage on its disk corresponding to the identifier/number
B. The pointer is de-referenced and the properties of the montage asset e.g. its full path , the animsequence , notifies etc are all serialised and sent as a whole instead

Essentially A.

If the pointer is to an asset on disk, then the ID will basically just be an asset path, allowing the client to find it locally.

If the pointer is to an actor, or a UObject created dynamically, then it becomes more complicated. There are then two distinct concepts; the replication of the object itself and its properties, and the replication/RPC of a pointer to an object. For the former, a network ID is established for the object, which creates a mapping between server and client. This is then used by the latter process - a pointer is mapped to an ID, the ID is passed over the network, the receiving machine looks up the ID and locates its copy of the object in memory.


Bonus question: would it make sense to send just numbers/index from a specific custom table structure for assets on disk rather than passing the Pointer as parameter to save network bandwidth? As sending a number would take say a byte and the receiver can look it up in the table while pointer would lead to sending entire full path string of 30 bytes or more.
I’m talking about very specific use cases , like say a RPC thats called quite often ,rather a general mechanic.

I don’t know exactly how it sends asset paths, but yeah no doubt it would be possible to reduce the bandwidth by doing it manually. You’d have to be sending them very frequently for something like that to be worth it though, and sending RPCs in that number is probably not a great plan.

True , however in my example its not like just one player making all RPCs but combined throughput from multiple players (NO! NOT MMO).

As to doing it manually I meant doing it on the Game module layer , where you simply send a number to server/client using a UFUNCTION which correspond to say index in an array of two dozens or more montages.

It Should save some bandwidth that can be used by other network things that can’t be generalised this way. But I also think that save would be pathetic unless it is a MMO with 200+ players