Hi,
I apologize if this question has been answered, but i didn’t know how to look for it properly…so:
I have a class(card) that contains a list of another class(MyResources) that i can free assign in the inspector:
my question is, is there a way for me to create this list with classes that inherit from MyResources but have different values, and they still appear in the inspector as above?
like the element 1 inherits from myResourceSpecial, so it will also appear another field such as a “isSpecial” bool.
so it would end up like:
Element 0:
Rec - as above
Value - as above
Element 1:
Rec - as above
Value - as above
Special - new Bool only for this or other elements that are myResourceSpecial
i tried to play with just the inheritance a bit but couldn’t figure out a way to achieve this…
keep in mind that for my project it doesn’t need to be a list of myResources(this was just a example), if i can assign 1 myResource to a single field and manage to create a dropdown with it’s parameters it would be fine.
i now i can do this with some custom editors(i know that i can, don’t know how) as i’m reading through some finished projects files.
public class Card : MonoBehaviour {
public int ID;
public cardType CardType;
public List<myResources> ResourceValues;
public List<myResources> ResourceCosts;
}
[CreateAssetMenu(fileName = "Resource", menuName = "Scriptable/Resource")]
public class ResourceBase : ScriptableObject
{
public Color32 color;
}
[System.Serializable]
public class myResources
{
public ResourceBase rec;
public int Value;
}