Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

CreateAssetMenu doesn't observe inheritance correctly

Discussion in 'Scripting' started by lord_goldemort, Jun 11, 2020.

  1. lord_goldemort

    lord_goldemort

    Joined:
    Oct 5, 2017
    Posts:
    11
    I have a base item class

    Code (CSharp):
    1. [CreateAssetMenu(...)]
    2. public ItemClass : ScriptableObject
    3. {
    4.     // etc
    5. }
    and a derived one

    Code (CSharp):
    1. [CreateAssetMenu(...)]
    2. public DerivedItemClass : ItemClass
    3. {
    4.     // etc
    5. }
    Unity warns me "CreateAssetMenu attribute on DerivedItem will be ignored as DerivedItem is not derived from ScriptableObject. Surely a bug?
     
  2. WarmedxMints

    WarmedxMints

    Joined:
    Feb 6, 2017
    Posts:
    1,035
    Which version of Unity are you using? This works fine for me.

    Maybe you have two classes with the same name and aren't inheriting from the correct namespace?
     
  3. lord_goldemort

    lord_goldemort

    Joined:
    Oct 5, 2017
    Posts:
    11
    Ugh, I'm tired and stupid. Those warnings in the console window were stale. Must remember to clear...