SW 중심대학 OSS GIT 서버 박건태, 이승준, 고기완, 이준호 새로운 배포
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
891 B

4 years ago
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEditor;
  5. namespace ARLocation
  6. {
  7. [CustomPropertyDrawer(typeof(ConditionalPropertyAttribute))]
  8. public class ConditionalPropertyDrawer : PropertyDrawer
  9. {
  10. public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
  11. {
  12. var conditionalAttribute = (ConditionalPropertyAttribute) attribute;
  13. var name = conditionalAttribute.Name;
  14. var path = property.propertyPath;
  15. var prop = property.serializedObject.FindProperty(path.Replace(property.name, name));
  16. if (prop != null)
  17. {
  18. Debug.Log($"NOT NULL!");
  19. if (prop.boolValue)
  20. {
  21. EditorGUI.PropertyField(position, property);
  22. }
  23. }
  24. }
  25. }
  26. }