Server and Client implementations both called

I’m trying to change the color (material) of an actor that I spawn during gameplay. It works when running on a server but not on a client. (The actor is spawned on the client but the material change is only visible when looking at the actor on a server.) To try to understand what is happening I created 3 functions:

changeColor()

UNFUNCTION(Client, Reliable)
void clientChangeColor();

UFUNCTION(Server, Reliable, WithValidatin)
void serverChangeColor();

My changeColor function calls both clientChangeColor and serverChangeColor. I put a breakpoint at the beginning of clientChangeColor_Implementation and serverChangeColor_Implementation thinking that one or the other will get hit, depending on whether I’m running a client or on a server. But on both client and server both breakpoints get hit every time. How is this possible?

Since your actor is owned by the client this is the behavior. See: RPCs in Unreal Engine | Unreal Engine 5.2 Documentation

There is a table there. If you invoke a function from the owning client to the server or client it gets executed on client/server.

The actor is spawned on the client but
the material change is only visible
when looking at the actor on a server.

Are you sure? If you spawn actor on a client - it will be cosmetic and not exist on server.

Got it. Thank you very much.