Search Issue Tracker
Postponed means that the issue was either a feature request or something that requires major refactoring on our side. Since that makes the issue not actionable in the close future we choose to close it as Postponed and add it on our internal roadmaps and technical debt pages instead.
Postponed
Votes
3
Found in [Package]
1.0.0-preview.14
Issue ID
1334140
Regression
No
PropertyDrawer.CreatePropertyGUI will not get called when using a CustomPropertyDrawer with a generic struct
How to reproduce:
1. Open the attached project
2. Open SampleScene
3. Select MyObject in the Scene Hierarchy
4. Observe MyComponent in the Inspector
Expected result: Two labels "Type A" and "Type B" are shown.
Actual result: "No GUI Implemented" and "Type B" is shown.
Reproducible with: 1.0.0-preview.3 - 1.0.0-preview.14 (2020.3.7f1, 2021.1.6f1), 2021.1.0a16
Could not test with: 2018.4.34f1, 2019.4.26f1 (UI Toolkit not supported)
-
KillHour
Mar 16, 2022 03:32
Hopefully this helps someone, but I was able to do this in a generic sense with the following:
[CustomEditor(typeof(MonoBehaviour), true)]
public class MonoBehaviourEditor : Editor
{
public override VisualElement CreateInspectorGUI()
{
var container = new VisualElement();
InspectorElement.FillDefaultInspector(container, serializedObject, this);
return container;
}
}
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- GetCurrentAnimatorClipInfoCount() and GetNextAnimatorClipInfoCount() return 0 when animator is in transition
- GPU utilization increases by 20% on Meta Quest headsets when Render Graph is enabled on 6000.0.16f1 and higher
- Value on Slider (Int) control in UI Builder displays as default when saving UI Document
- Color mismatch in UI Builders Library panel when the Editors theme is set to Light Mode
- [Android ] "AndroidJNI.ToBooleanArray" returns a random non-zero value instead of "IntPtr.Zero" when the method argument is null
Resolution Note:
UIToolkit property drawers are only supported when embedded inside a UIToolkit custom editor. This limitation will be addressed in a future release. From the time being, you can declare a custom UIToolkit editor that will look like the default inspector this way:
[CustomEditor(typeof(MyComponent))]
public class MyComponentEditor : Editor
{
public override VisualElement CreateInspectorGUI()
{
var container = new VisualElement();
// If you're running a recent version of the package, or 2021.2, you can use
// InspectorElement.FillDefaultInspector(container, serializedObject, this);
// otherwise, the code below basically does the same thing
SerializedProperty property = serializedObject.GetIterator();
if (property.NextVisible(true)) // Expand first child.
{
do
{
var field = new PropertyField(property);
field.name = "PropertyField:" + property.propertyPath;
if (property.propertyPath == "m_Script")
{
if ((serializedObject.targetObject != null))
field.SetEnabled(false);
}
container.Add(field);
}
while (property.NextVisible(false));
}
return container;
}
}