TechLord
(TechLord)
January 22, 2020, 6:00pm
2
Per Post How do I replicate a UProceduralMeshComponent? #4:
Actor that called SpawnActor() doesn’t need to be replicated, however this spawning has to happen on server (or on Authorative client that is currently acting as server)
Replicated properties don’t have to be public; replication works when property is updated on the server, and will be sent to all connected clients (and clients that connect later).
UPROPERTY(Replicated) works on replicated actors and replicated components. Say if Actor is replicated but component isn’t, component’s property will not be replicated regardless of how its declared.
ProceduralMeshComponent, however, doesn’t have built-in replication. You’ll need to code it yourself. Even if you mark component as replicated, ProcMeshSections array inside of it is not marked as replicated. Further complication is that you can’t replicate arrays larger than about 1000 elements. UDP is not very friendly towards sending large chunks of data.
Your declaration within actor is correct, and replication would correctly create a new blank ProceduralMeshComponent that needs to be initialized separately on each client. Effectively, replication would be useless.
Your best bet would be to replicate instructions that will cause ProceduralMeshComponent to be created the same way on all connected clients.
Good luck!
These are great tips. I had to implement a custom movement replication function for the the sliced procmeshcomponents half sections generated with the slicing to keep the sections orientation on the server/clients sync, This is orientation sync is required to ensure slice plane is replicated properly on all clients.