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
4
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)
Comments (1)
-
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
- Terrain's "Brush Masks" Overlay's default color doesn't match other Overlays
- Additional settings dropdown in Terrain Overlay is not grayed out for painting modes with no extra settings
- Inconsistent Terrain brush Opacity values between Scene view and Inspector
- [Usability] No separated opacity for the different types of Terrain brushes
- [Quest] Pitch Shifter causes audio degradation on Quest 2 devices when sped up
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;
}
}