public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { DefultGameObjectAttribute att = (DefultGameObjectAttribute)attribute; if (property.propertyType == SerializedPropertyType.ObjectReference) { EditorGUI.PropertyField(position, property, new GUIContent(att.title)); if (property.objectReferenceValue == null && property.serializedObject.targetObject is MonoBehaviour) { property.objectReferenceValue = (property.serializedObject.targetObject as MonoBehaviour).gameObject; } } }
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { DefultGameObjectAttribute att = (DefultGameObjectAttribute)attribute; return(EditorGUIUtility.singleLineHeight); }