- changed status to wontfix
OdinSerialize does not work on property that is implemented by interface
Issue #125
wontfix
If a property is implemented as part of an interface implementation, the OdinSerialize attribute will not serialize the property. Simple example attached. I looked through the manual and didn't see anything mentioning this, so I figured it must be a bug.
Using: Unity 5.6.2 Odin 1.0.3.0 Windows 10
Comments (1)
-
- Log in to comment
Thanks for the report!
Declaring a property which is defined on an interface actually causes that property to be marked as virtual, meaning Odin won't (and shouldn't) serialize it, as it could be updated with custom method logic (if not in your class, then in a deriving class further down) and Odin has no way of telling whether it has - and we currently don't serialize properties where there is a chance that custom property get/set logic may run during serialization. That's a can of worms we don't want to open.
In your example case, the MyFloat property getter is marked as virtual because BreakingInterface is defined on the class.
I've updated the manual's serialization section to explicitly explain this case.