Esempio n. 1
0
        public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
        {
            BindOrLocalWarningAttribute attr = ((BindOrLocalWarningAttribute)attribute);

            float result = EditorGUI.GetPropertyHeight(property, label, true);

            if (property.objectReferenceValue == null && getCandidate(property) == null)
            {
                result += 45;
            }

            return(result);
        }
Esempio n. 2
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            EditorGUI.PropertyField(position, property, label, true);

            BindOrLocalWarningAttribute attr = ((BindOrLocalWarningAttribute)attribute);
            Rect   warningBox  = new Rect(position);
            string warningText = "";

            Object value = property.objectReferenceValue;

            if (value == null && getCandidate(property) == null)
            {
                warningText += "Must be bind or locally available";
            }

            if (warningText.Length > 0)
            {
                float propertyHeight = EditorGUI.GetPropertyHeight(property, label, true);
                warningBox.yMin += propertyHeight;
                warningBox.yMax -= 5;
                EditorGUI.HelpBox(warningBox, warningText, MessageType.Error);
            }
        }