Currently the NullableTrait isn't handled, and thus both serializer and deserializer fail for Opt<T> types.
One example is the RenderTargetDefaults component from the renderDefaultsPlugin. It contains the optional fields bloom and splitScreen. It should be possible to just add "bloom": null to the scene file to disable the optional.
Solution
When a type with NullableTrait is found, it should be checked. If it is null, null should be serialized.
On deserialization, if null is found, then the type should be set to null.
Problem
Currently the NullableTrait isn't handled, and thus both serializer and deserializer fail for
Opt<T>
types. One example is theRenderTargetDefaults
component from therenderDefaultsPlugin
. It contains the optional fieldsbloom
andsplitScreen
. It should be possible to just add"bloom": null
to the scene file to disable the optional.Solution
When a type with NullableTrait is found, it should be checked. If it is null,
null
should be serialized. On deserialization, ifnull
is found, then the type should be set tonull
.