public VisualElement CreateField(int index) { var key = _keysProperty.GetArrayElementAtIndex(index); var value = _valuesProperty.GetArrayElementAtIndex(index); var field = _drawer != null ? _drawer.CreatePropertyGUI(value) : value.CreateField(); field.userData = index; field.Bind(_property.serializedObject); if (field is PropertyField propertyField) { propertyField.SetLabel(key.stringValue); } else if (field is FieldContainer fieldContainer) { fieldContainer.SetLabel(key.stringValue); } if (field.GetType().InheritsGeneric(typeof(BaseField <>))) { BaseFieldExtensions.SetLabel(field, key.stringValue); } return(field); }
public VisualElement CreateElement(int index) { var property = _property.GetArrayElementAtIndex(index); var field = _drawer?.CreatePropertyGUI(property) ?? property.CreateField(); field.Bind(_property.serializedObject); if (!(field is Foldout)) { field.SetFieldLabel(null); // TODO: for references this should be the type name } return(field); }
public VisualElement CreateElement(object value) { if (_drawer != null) { return(_drawer.CreatePropertyGUI(_property)); } else { var container = new VisualElement(); foreach (var child in _property.Children()) { var field = new PropertyField(child); field.Bind(_property.serializedObject); // this is only called automatically when the inspector is first created container.Add(field); } return(container); } }
public VisualElement CreateElement(int index, string key) { var value = _valuesProperty.GetArrayElementAtIndex(index); var field = _drawer?.CreatePropertyGUI(value) ?? value.CreateField(); field.Bind(_property.serializedObject); if (string.IsNullOrEmpty(key)) { key = " "; // An empty label will cause the label to be removed } if (field.SetFieldLabel(key)) // TODO: for references this should include the type name { return(field); } else { var container = new FieldContainer(key); container.Add(field); return(container); } }
public VisualElement CreateElement(int index) { var property = _property.GetArrayElementAtIndex(index); var field = _drawer?.CreatePropertyGUI(property) ?? property.CreateField(); field.userData = index; field.Bind(_property.serializedObject); if (field is PropertyField propertyField) { propertyField.SetLabel(null); } else if (field is FieldContainer fieldContainer) { fieldContainer.SetLabel(null); } else if (field.GetType().InheritsGeneric(typeof(BaseField <>))) { BaseFieldExtensions.SetLabel(field, null); } return(field); }