Search Unity

Why is my Asset Database not saving child type?

Discussion in 'Asset Database' started by Maximilious, Feb 23, 2018.

  1. Maximilious

    Maximilious

    Joined:
    Nov 29, 2016
    Posts:
    28
    I have Class Item, which is scriptableobject... I have 3 derived classes "Armor, Weapon, Accessory".

    This is how the UI looks like when I create an object of type Weapon

    https://i.imgur.com/6Y97L3H.png

    When I check the type of the object created, is ItemWeapon, which is good since that is one of the child classes from Item.

    HOWEVER, when I close unity and open it again the type changes from ItemWeapon to Item, and the properties of ItemWeapon are gone (such as Attack speed, damage, block, Weapon Type, etc..)

    Is it possible to save child type objects in a parent type class while keeping the child properties or no?
    When I look at the inspector of the file, the child properties are not being saved to it, see

    https://i.imgur.com/cEZSltc.png
     
  2. PsychoticLab

    PsychoticLab

    Joined:
    Aug 13, 2017
    Posts:
    9
    How are you creating the scriptable objects?