- Home /
Question by
spartan12k · Sep 09, 2021 at 10:56 PM ·
variableinheritancecustom class
Custom class does not show in inspector
UNIVERSALINVENTORY:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(menuName = "Universal/UniversalInventory")]
public class UniversalInventory : ScriptableObject
{
public List<UniversalSlot<UniversalObject>> Container;
}
[System.Serializable]
public class UniversalSlot
{
public T KeyObject;
public UniversalSlot(T keyObject)
{
KeyObject = keyObject;
}
}
ITEMINVENTORY:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(menuName = "Item/ItemInventory")]
public class ItemInventory: UniversalInventory
{
public new List<ItemSlot> Container;
}
[System.Serializable]
public class ItemSlot : UniversalSlot
{
public int CurrentValue;
public ItemSlot(ItemObject keyObject, int currentValue) : base(keyObject)
{
KeyObject = keyObject;
CurrentValue = currentValue;
}
}
ItemInventory will properly show the ItemSlot Container in the inspector, but not the UniversalInventory Container.. I'm confused as to why?
Comment
ItemInventory will properly show ListContainer in the inspector, but not List>. I'm confused as to why?
Your answer
![](https://koobas.hobune.stream/wayback/20220613042833im_/https://answers.unity.com/themes/thub/images/avi.jpg)