How to create drag-drop slots on scriptable objects?

I have scriptable object items and scriptable object loot tables. I’d like to add items to the loot tables via drag-and-drop.

If I create a scriptable object like this:

[CreateAssetMenu]
    public class LootTable : ScriptableObject
    {
        public List<ChestLoot> Items = new List<ChestLoot>();
    }

And ChestLoot is also a scriptable object - this works… however, in the editor, if I enter 5 as the number of items in my Items list, I get 5 Chest Loot entries to fill out the data myself. What I want is 5 “slots” so I can click and drag my 5 scriptable object items into the loot table. I hope any of that made sense.

Hm, check your work because as long as ChestLoot is a ScriptableObject, you can create those files all day long and drag them into your Items[ ] array…

Or am I not understanding what you’re looking for?

:roll_eyes: - Apologies’ - It seems ChestLoot was serializable (not scriptable) and I was supposed to be using an entirely other class called GameItem. Once I swapped that out I got the behavior I wanted!

Thanks!

1 Like