AOT generator does not detect enum type inside class

Issue #471 resolved
任才 created an issue

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)

  1. 任才 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.

  2. Jakub Kasztalski

    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

    missing.jpg

    Globally defined Enums (EGender) and classes (CMHeadlinerEp2ScenarioVars) are loading fine.

    Would very much appreciate the help :)

  3. Log in to comment