Polymorphic serialization in the Models project is really nice for helping to allow submit various types of events while getting immediate validation on the serialization from the C# Json validation. However, it requires using the JsonSubTypes package which has a dependency on Newtonsoft.Json which clashes with Unity's built-in version.
Remove the dependency on the JsonSubTypes package and instead of using Polymorphic game events, just store the event data as a JSON string representation of the particular event.
Ensure that you add validation for parsing the serialized game event data into the type of even the user claims the data to be for.
Make the C# client accept the raw game event and serialize it automatically instead of making users of the client serialize their own events if possible.
Enhancement Description
Polymorphic serialization in the
Models
project is really nice for helping to allow submit various types of events while getting immediate validation on the serialization from the C# Json validation. However, it requires using theJsonSubTypes
package which has a dependency on Newtonsoft.Json which clashes with Unity's built-in version.Remove the dependency on the
JsonSubTypes
package and instead of using Polymorphic game events, just store the event data as a JSON string representation of the particular event.For example:
Ensure that you add validation for parsing the serialized game event data into the type of even the user claims the data to be for. Make the C# client accept the raw game event and serialize it automatically instead of making users of the client serialize their own events if possible.