I have a serialisable scriptable object called Item which only consists of a field for a list of structs called ItemData.
[Serializable]
[CreateAssetMenu(fileName = "item", menuName = "Inventory/Item", order = 1)]
public class Item : ScriptableObject
{
[SerializeField]
public List<ItemData> data;
}
I want to make it so that I can add to the list of structs where each struct has an identifier, a way to choose the type of value, and the value itself similar to how the variables work for visual scripting (Example image attached) where I can configure it from the unity editor. But I haven’t been able to figure out or find a way to do it.
[Serializable]
public struct ItemData
{
// i dont know what goes here
// eg:
public string id;
public Type type;
public type Value;
}
This isn’t exactly what I’m looking for. I want to be able to add attributes to an item with different types so, for example, I could add a variable called “name”, with a value whose type is string and stores “Sword”, and then add another variable called “damage”, with a value of type float and stores 100. Like the variables shown in the image however they use visual scripting’s variable system whereas I want my own integrated into a struct for each variable but I also don’t want to make a scriptable object for each variable.