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

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
namespace ARLocation
{
[CustomPropertyDrawer(typeof(ConditionalPropertyAttribute))]
public class ConditionalPropertyDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
var conditionalAttribute = (ConditionalPropertyAttribute) attribute;
var name = conditionalAttribute.Name;
var path = property.propertyPath;
var prop = property.serializedObject.FindProperty(path.Replace(property.name, name));
if (prop != null)
{
Debug.Log($"NOT NULL!");
if (prop.boolValue)
{
EditorGUI.PropertyField(position, property);
}
}
}
}
}