} // public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { EditorGUI.LabelField(position, GUIContent.none, EditorStyles.helpBox); position.height *= 0.5f; position = EditorGUI.PrefixLabel(position, label); property.Next(true); EditorGUI.PropertyField(position, property, GUIContent.none); position.y += position.height; if (property.objectReferenceValue == null) { EditorGUI.LabelField(position, "No Object selected"); } else { position.width *= 2 / 3f; System.Type type = property.objectReferenceValue.GetType(); remoteValue.TargetObject = property.objectReferenceValue; property.Next(false); int index = System.Array.IndexOf(FindNames(type), property.stringValue); index = index < 0 ? 0 : index; index = EditorGUI.Popup(position, index, FindNames(type)); property.stringValue = index == 0 ? string.Empty : FindNames(type)[index]; remoteValue.SetFieldName(property.stringValue, true); position.x += position.width; position.width *= 1 / 2f; if (remoteValue.HasValue) { DrawValueLabel(position, remoteValue.value); } } } //