Instance fields with enum types serialized with [OdinSerialize] are reverted to their default values when applied to a prefab
Problem: Enum instance fields serialized with [OdinSerialize] are reverted to their default values when applying a prefab instance to a prefab. This is on a class inheriting from SerializedMonoBehaviour.
Note: Please remove the previous issue "#61: Prefab serialization example throws errors" Sorry! I had forgotten to change the title to the one in this post. Love what you guys are up to! Keep it up.
Unity Version: 5.6.0f3
Comments (5)
-
-
- changed status to open
-
So after some investigation, I've narrowed it down to the following: The problem only seems to happen with public enum fields marked with the OdinSerialize attribute. I may have missed something and this is a part of the serialization system. Is Unity's serialization of the public field conflicting with Odin's? Replacing the public enum field with an integer works fine.
This works...
public enum Heat { Hot, Cold } public class Test : SerializedMonoBehaviour { [OdinSerialize] Heat heat; }
This does not...
public enum Heat { Hot, Cold } public class Test : SerializedMonoBehaviour { [OdinSerialize] public Heat heat; }
-
Ah, I suspect I know what the issue may be. Will look into this as soon as I get a moment to do so.
-
- changed status to resolved
This issue should be resolved in the upcoming patch 1.0.0.3.
- Log in to comment
Can you post the code that is causing the problem? Just ran this example which seemed to work just fine.