colyseus / colyseus-unity-sdk

⚔ Colyseus Multiplayer SDK for Unity
https://docs.colyseus.io/getting-started/unity-sdk/
MIT License
371 stars 102 forks source link

Prevent mutatibility of schema properties #140

Open rthery opened 3 years ago

rthery commented 3 years ago

Even after reading the official documentation, I wasn't 100% certain that Colyseus was only server authoritative (although I was 95% maybe ;))

What made me doubt is the fact that schema properties are actually public fields in the generated C# classes! Since state cannot be mutated directly on the client side, we shouldn't allow this. Best to make these fields internal with a public getter, the intent will then be clear for any C# developer.