-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to preset a UnityResolvers in VYaml.Unity #91
Comments
@MonoLogueChi Thanks so much. PR is welcome. EDIT: It might cause problems with testing on the .net side. We will probably need to exclude the unity folder. However, I can rework this after I merge your commits. |
Okay, I'll try not to break the original code and keep the style consistent. The serialization I implemented is similar to the style of MessagePack-CSharp, that is
This will not only make it easier to edit the configuration file, but will also be more efficient. The parser that needs to be implemented will refer to Newtonsoft.Json-for-Unity.Converters |
If I need to create a tool class and place some public code, where should I create it? The code is similar to this internal static class Utils
{
public static void WriteFloatArrayWithFlowStyle(ref Utf8YamlEmitter emitter, IEnumerable<float> value,
YamlSerializationContext context)
{
emitter.BeginSequence(SequenceStyle.Flow);
foreach (var f in value) emitter.WriteFloat(f);
emitter.EndSequence();
}
public static void WriteByteArrayWithFlowStyle(ref Utf8YamlEmitter emitter, IEnumerable<byte> value,
YamlSerializationContext context)
{
emitter.BeginSequence(SequenceStyle.Flow);
foreach (var b in value) emitter.WriteInt32(b);
emitter.EndSequence();
}
public static void WriteIntArrayWithFlowStyle(ref Utf8YamlEmitter emitter, IEnumerable<int> value,
YamlSerializationContext context)
{
emitter.BeginSequence(SequenceStyle.Flow);
foreach (var i in value) emitter.WriteInt32(i);
emitter.EndSequence();
}
} |
I have been sorting out the code recently and found that instead of merging it into VYaml, creating a VYaml.UnityResolvers project myself may be a better choice. The reasons are as follows
|
Thanks for the good work ! VYaml would like to focus on Unity. |
I decided to port it to the main repo. #106 |
In some cases, I will need to serialize and deserialize Unity types, such as Vector3, Color, etc. Although I implemented part of it myself, I would like to have a UnityResolvers that contains commonly used Unity types and is automatically enabled when using Unity. Just like MessagePack-CSharp.
The text was updated successfully, but these errors were encountered: