Hey all I would like to create a draggable foldout for my editor window (or inspector would be fine) like the ones used by the project window and hierarchy.
Here’s the Story :
I have a scriptable object asset and its job is to provide a database for all world (“pickup items”) in my game. if I just add a list to my scriptable object, it as you know will eventually become like a rat’s nest in the inspector. So the idea is to create a makeshift pathing system in the asset class that can be used as a reference to the world item.
The foldouts would then work as the “folders” similarly to how the asset folder foldouts do.
Thanks.
I don’t know if it will help but here’s the world item class that has the field for a path so you can get an understanding of what i’m talking about as far as a pathing system for world items goes.
[System.Serializable]
public class WorldItem{
public string itemName = "", itemPath = "";
public ItemEnhancementCode[] enhancementCodes = new ItemEnhancementCode[0];
public float weightPerItem = 0;
public InventoryItemType itemType = InventoryItemType.Misc;
public Currency venderCostPer = Currency.zero, venderSellPricePer = Currency.zero;
public Sprite inventoryImage = null;
public InventoryItem ToInventoryItem(){
return ToInventoryItem (1, 0);
}
public InventoryItem ToInventoryItem(int ammount){
return ToInventoryItem (ammount, 0);
}
public InventoryItem ToInventoryItem(int ammount, int ammountStolen){
return new InventoryItem (itemName, ammount, ammountStolen, enhancementCodes, weightPerItem, itemType, venderCostPer, venderSellPricePer);
}
public static explicit operator InventoryItem(WorldItem worldItem){
return worldItem.ToInventoryItem ();
}
}