I have a player state enumerator I’m using for testing to make sure things happen across all the clients and the listen server, and I was noticing that my code wasn’t having any effect on the listen server, despite working on the clients. So I was wondering what the heck was going on, and the problem ended up being that because I changed the value of the state in the inspector, it wasn’t working for the host, despite working on the clients… Is this intended behavior? If I set the value of the player state before I play test, then the listen server adjusts accordingly, but doing so at run time does nothing, despite working on the clients.
When you change states in live play “locally” they are not applied to the servers copy of the class.
You need to create custom events that RPC the server the changes.
I’m still a little confused, could you clarify a couple things for me? Why does it allow other clients to change states then? If I play as a client, and I have like 3 different players, and I switch between states, the client’s Movement Input and Control Rotation are replicated fine, and state changes are replicated fine, to the other clients. Since it’s allowing the movement and state changes to occur and be visible to other clients, it leads me to believe the server has authorized it implicitly already, so why does the server not pick up on it’s own copy changing values in the inspector?
Replication is only Server → Client. Character movement component (cmc) has built in replication for movement input, control rotation, base aim rotation and a few states. But you have to use CMC’s functions for it to happen.
Depends on what you’re changing and how. Manually changing a state on a local client without RPC’ing the server to make the same change will not not replicate out to other clients.
What you need to do is have an event RPC (run on server) make the change. If the state is a replicated variable it’ll trickle down.