List of Abstract classe not in Inspector

Issue #14 resolved
João Cabral created an issue

public abstract class A : MonoBehaviour {} public class B : A {} public class C : A {}

public List<A> someList;

someList does not appear in inspector using Odin Inspector.

Comments (7)

  1. Tor Esa Vestergaard

    We've replicated this issue, and a fix has been introduced to the next patch. Thank you for the report! Meanwhile, you can ameliorate the bug and force the list to show up, by decorating it with [ShowInInspector].

  2. João Cabral reporter

    hmm... the [ShowInInspector] workaround does not seem to work for me can you confirm it works?

  3. Bjarke Elias

    Just a quick and maybe stupid question - because for me everything seems to work fine.

    Does each of your classes have its own script file with the same name as the class, so unity can properly it as a component?

  4. João Cabral reporter

    yeah, they do.

    Just did a few tests and still have these problems. Here's exactly the test I did:


    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public abstract class A: MonoBehaviour{}


    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using Sirenix.OdinInspector;
    public class B: MonoBehaviour {
        public List<A> AList= new List<A>();

    The List does not appear in the Inspector. If I disable OdinInspector foi the script B (in the "Editor Types" preferences), the List appears in the Inspector with the default Unity interface.

  5. Tor Esa Vestergaard

    I've investigated this, and [ShowInInspector] not causing the property to show up is a separate bug. Sorry about that - but it's a good one to catch. I've also fixed that bug now ;)

    For now, the member will show up if you apply the lengthily named attribute [ShowOdinSerializedPropertiesInInspector] to the type B. (If you do that, there's no need to apply [ShowInInspector] to the list ListA field.) Do note that applying this attribute to your type would also make fields like "public object someObj" show up in the inspector, as the inspector will be acting as if Odin is serializing the type - without it actually doing so.

  6. Log in to comment