- edited description
AOT generator does not detect enum type inside class
What happened?
We have some code like this:
// Note: Data is a plain C# class type, not inherited from any unity type like MonoBehaviour or ScriptableObject
public class MyData : Data
{
public enum State
{
Idle,
Die,
}
public State currentState;
}
AOT did not detect MyData.State
, and reported an error:
No AOT serializer was pre-generated for the type 'MyData.State'. Please use Odin's AOT generation feature to generate an AOT dll before building, and ensure that 'MyData.State' is in the list of supported types after a scan. If it is not, please report an issue and add it to the list manually.
How can we reproduce it?
Just write some code like above will reproduce it.
If screenshots would help explain or demonstrate your issue, please include these.
No need for screenshot.
What version of Unity are you using?
Unity 2017.4.6f1
What version of Odin are you using? (See "Tools > Odin Inspector > About")
2.0.0
Do you have Editor Only mode enabled?
Nope.
What operating system are you on?
Windows 10 x64
Comments (6)
-
reporter -
Hey there,
From where is that data being serialized? (Does it live in a SerializedMonoBheaviour)? And where is that gameobject being saved to?
There has also been a couple of improvements to the AOT Scanner since 2.0.0 http://sirenix.net/odininspector/releasenotes Have you tried upgrading to see if that fixes it?
-
reporter Hi there,
The data is included in a SerializedMonoBehaviour as a list like the following:
// Stored as prefabs public class Entity : SerializedMonoBehaviour { public List<Data> datas; }
And since
Data
has a lot of inherited types, it is serialized polymorphically.We haven't tried upgrade to the latest build. We're planning to do that.
-
reporter We upgraded Odin Inspector to the latest version and the problem go away, thanks.
-
reporter - changed status to resolved
-
I just ran into the same issue, and using Odin 2.0.15 with Unity 2018.2.20f. When I add my enum in the list under Odin Inspector->Preferences\AOT Generation, it states "Missing."
I tested it both as just a class (no inheritance) and class inheriting from SerializedMonoBehavior. Same thing. Here's an example for ETestEnum
Globally defined Enums (EGender) and classes (CMHeadlinerEp2ScenarioVars) are loading fine.
Would very much appreciate the help :)
- Log in to comment