The inspector of Star Equip Unequip error:
C#:
public class ItemSetCategoryDrawer : ObjectDrawer
{
public override void OnGUI(GUIContent label)
{
// ItemSetManagerBase must exist for the categories to be populated.
var itemSetManager = GameObject.FindObjectOfType<ItemSetManagerBase>();
if (itemSetManager == null) {
return;
}
itemSetManager.Initialize(false);
if (itemSetManager.ItemSetGroups == null || itemSetManager.ItemSetGroups.Length == 0) {
return;
}
// Draw a popup with all of the ItemSet groups.
var categoryID = (value as SharedUInt).Value;
var selected = -1;
var categoryNames = new string[itemSetManager.ItemSetGroups.Length];
for (int i = 0; i < categoryNames.Length; ++i) {
categoryNames[i] = itemSetManager.ItemSetGroups[i].CategoryName;
if (categoryID == itemSetManager.ItemSetGroups[i].CategoryID) {
selected = i;
}
}
var newSelected = EditorGUILayout.Popup("ItemSet Category", (selected != -1 ? selected : 0), categoryNames);
if (selected != newSelected || categoryID == 0) {
(value as SharedUInt).Value = itemSetManager.ItemSetGroups[newSelected].CategoryID;
}
}
}