bool showPosition = false;
private void DrawElement(Rect rect, int index, bool active, bool focused)
{
EditorGUI.BeginChangeCheck();
Item item = targetscript.items[index];
item.id = EditorGUI.IntField(new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight), "ID", item.id);
item.name = EditorGUI.TextField(new Rect(rect.x, rect.y + 20, rect.width, EditorGUIUtility.singleLineHeight), "Name", item.name);
item.description = EditorGUI.TextField(new Rect(rect.x, rect.y + 40, rect.width, EditorGUIUtility.singleLineHeight), "Description", item.description);
GUILayout.BeginHorizontal();
item.sprite = (Sprite)EditorGUI.ObjectField(new Rect(rect.x, rect.y + 60, rect.width, EditorGUIUtility.singleLineHeight), "Sprite", item.sprite, typeof(Sprite), false);
GUILayout.EndHorizontal();
if (showPosition = EditorGUI.Foldout(new Rect(rect.x, rect.y + 80, rect.width, EditorGUIUtility.singleLineHeight),showPosition, "Foldout"))
{
item.executable = EditorGUI.Toggle(new Rect(rect.x, rect.y + 100, rect.width, EditorGUIUtility.singleLineHeight), "Executable", item.executable);
item.stackable = EditorGUI.Toggle(new Rect(rect.x, rect.y + 120, rect.width, EditorGUIUtility.singleLineHeight), "Stackable", item.stackable);
item.removeable = EditorGUI.Toggle(new Rect(rect.x, rect.y + 140, rect.width, EditorGUIUtility.singleLineHeight), "Removeable", item.removeable);
item.hotbar = EditorGUI.Toggle(new Rect(rect.x, rect.y + 160, rect.width, EditorGUIUtility.singleLineHeight), "Hotbar", item.hotbar);
}
if (EditorGUI.EndChangeCheck())
{
EditorUtility.SetDirty(target);
serializedObject.ApplyModifiedProperties();
}
}