ItemRecipeDrawer.cs 1.1 KB

1234567891011121314151617181920212223242526272829
  1. using UnityEngine;
  2. using UnityEditor;
  3. using UnityEditorInternal;
  4. namespace HQFPSWeapons
  5. {
  6. // [CustomPropertyDrawer(typeof(ItemRecipe))]
  7. // public class ItemRecipeDrawer : PropertyDrawer
  8. // {
  9. // public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
  10. // {
  11. // property.isExpanded = true;
  12. //
  13. // GUI.Label(position, "Recipe", EditorStyles.boldLabel);
  14. //
  15. // position.y = position.yMax + 3f;
  16. // EditorGUI.PropertyField(position, property.FindPropertyRelative("Duration"));
  17. //
  18. // position.y = position.yMax + 3f;
  19. // EditorGUI.PropertyField(position, property.FindPropertyRelative("RequiredItems"));
  20. // }
  21. //
  22. // public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
  23. // {
  24. // var reqItemsHeight = property.isExpanded ? new ReorderableList(property.serializedObject, property.FindPropertyRelative("RequiredItems").FindPropertyRelative("m_List")).GetHeight() : 16f;
  25. // return property.isExpanded ? (2 * EditorGUIUtility.singleLineHeight + reqItemsHeight) : EditorGUIUtility.singleLineHeight;
  26. // }
  27. // }
  28. }