File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,36 @@ public class Player : MonoBehaviour
9494
9595[ See] ( https://github.com/neuecc/MessagePack-CSharp#aot-code-generation-support-for-unityxamarin )
9696
97+ ``` csharp
98+ using MessagePack ;
99+ using MessagePack .Resolvers ;
100+ using MessagePack .Unity ;
101+ using MessagePack .Unity .Extension ;
102+ using Serializer ;
103+ using ToolBox .Serialization ;
104+ using UnityEngine ;
105+
106+ public static class MessagePackStartup
107+ {
108+ [RuntimeInitializeOnLoadMethod (RuntimeInitializeLoadType .BeforeSceneLoad )]
109+ private static void Setup ()
110+ {
111+ StaticCompositeResolver .Instance .Register (
112+ GeneratedResolver .Instance ,
113+ UnityBlitResolver .Instance ,
114+ UnityResolver .Instance ,
115+ StandardResolver .Instance ,
116+ DataSerializerResolver .Instance
117+ );
118+
119+ var options = ContractlessStandardResolverAllowPrivate .Options .WithResolver (StaticCompositeResolver .Instance );
120+
121+ DataSerializer .Options = options ;
122+ MessagePackSerializer .DefaultOptions = options ;
123+ }
124+ }
125+ ```
126+
97127## Performance test
98128
99129### PlayerPrefs result: 00:00:00.0429685
You can’t perform that action at this time.
0 commit comments