打包过程出现的问题
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
[CustomPropertyDrawer(typeof(ConditionalFieldAttribute))]
|
||||
public class ConditionalFieldDrawer : PropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
ConditionalFieldAttribute conditional = (ConditionalFieldAttribute)attribute;
|
||||
SerializedProperty conditionProperty = property.serializedObject.FindProperty(conditional.conditionField);
|
||||
|
||||
if (conditionProperty != null && conditionProperty.boolValue)
|
||||
{
|
||||
EditorGUI.PropertyField(position, property, label, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
ConditionalFieldAttribute conditional = (ConditionalFieldAttribute)attribute;
|
||||
SerializedProperty conditionProperty = property.serializedObject.FindProperty(conditional.conditionField);
|
||||
|
||||
if (conditionProperty != null && conditionProperty.boolValue)
|
||||
{
|
||||
return EditorGUI.GetPropertyHeight(property, label, true);
|
||||
}
|
||||
|
||||
return 0f; // 隐藏字段时的高度
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user