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
- var VisionOSEDRHeadromm has a comma instead of a dot when building with Metal Rendering App Mode and local OS localization is set to German
- IAP Catalog remove product “x” and add product “+” buttons are not consistent with other remove and add buttons in the Editor
- Performance issues in Play Mode when quickly hovering the mouse cursor over Hierarchy GameObjects
- Frame Debugger displays incorrect output when FidelityFX Super Resolution or Spatial-Temporal Upscaler is used with Temporal Anti-aliasing or Subpixel Morphological Anti-aliasing
- The layout system is failing to correctly calculate or apply the height of the Japanese fallback font when the primary English font's metrics are used
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;
}
}