How do I replicate a dynamic material that changes at runtime?

I have a static mesh actor that has a material… Now the actor replicates fine however the material never does due to it being dynamic and often changing throughout the game.

So how do I go about doing this? I can’t use an RPC because my client doesn’t have reference to the replicated static mesh actor. Or at least I don’t think my client can reference the static mesh actor, I am new to replication so bare with me.

Any help here would be great,

Pots3

I’d suggest creating a replicated variable in this actor, that holds information about the property of the material, and link material to this variable. If you want to react somehow to the changes of this variable you can also use OnRepNotify function.

Are you doing this in code or in Blueprint?

I decided to take another approach and have the client actually spawn the objects themselves on their side of things with the correct materials that have been sent over from the server and then just have the server update the clients positions based on where the servers objects currently are.

Trying to get the materials to replicate was turning into a real pain and this way seems to work quite well.

One other problem I am having though and I don’t know if you can help with this but the clients characters positions are again being updated by the server using Client_Implementation and the Server is sending this information and the Client is then calling SetActorLocation() based on these positions however the client seems to never move from (0, 0, 0), I can’t seem to figure out why this is happening.

Oh and to answer your question I am doing this in code!

Pots3

Client_ methods are called only on the client that has authority over the object. Under normal circumstances it’s PlayerController and possessed pawn of a player. If you want to replicate some behavior to all clients, you should rather use Multicast replication method.

Also, by sending location via rpc method and setting location on clients, you are essentially reinventing the movement replication mechanism of the engine. What kind of object are you replicating this way? Because most objects are autmatically replicated, and even if you would set something on clients, it may overriden in next net update from the server.

I’m replicating a static mesh actor which indeed does replicate fine but its material is created at run time and set on the mesh however when replicated all the client could ever see was the static mesh actors default material. The only issue I have noticed with sending the positions (and I have no idea if this is the culprit) is the screen on the client seems to flicker every now and again?

I’m having this same problem, did you ever figure it out?