public static IEnumerable <PropertyEditorData> GetProperties( this object target, SerializedProperty targetProperty, SerializedProperty parent) { var property = targetProperty.Copy(); var type = target.GetType(); var moveNext = property.NextVisible(true); var next = parent?.GetNextArrayProperty(targetProperty); while (moveNext && !property.IsEquals(targetProperty) && (next == null || !next.IsEquals(property))) { var propertyData = new PropertyEditorData() { Target = target, Name = property.name, Tooltip = property.tooltip, Source = target, Type = type, Property = property.Copy(), }; yield return(propertyData); moveNext = property.NextVisible(false); } }
private IMGUIContainer DrawImGuiField(PropertyEditorData field, GUIContent label) { var property = field.Property; var imGuiContainer = new IMGUIContainer(() => { var color = GUI.contentColor; GUI.color = Color.white; EditorGUIUtility.labelWidth = 84; EditorGUILayout.PropertyField(property, label, true); GUI.color = color; }); return(imGuiContainer); }
private VisualElement DrawField(PropertyEditorData field) { var property = field.Property; var label = new GUIContent(field.Name, field.Tooltip); if (property.propertyType == SerializedPropertyType.ObjectReference && (property.objectReferenceValue is GameObject) == false) { var odinFieldView = new OdinFieldView() { Label = label, Property = property, IsOpen = false, }; return(odinFieldView.View); } return(DrawImGuiField(field, label)); }