Hey everyone,
I’ve noticed some strange behavior regarding rendering a combination of CustomEditors and CustomPropertyDrawers.
Replication code source:
So, let’s assume the following classes:
[Serializable]
public class TestModel
{ }
[CreateAssetMenu(fileName = "TestObject", menuName = "Test/TestObject")]
public class TestObject : ScriptableObject
{
[SerializeField]
private TestModel _model;
}
[CustomPropertyDrawer(typeof(TestModel))]
public class TestModelEditor : PropertyDrawer
{
public override VisualElement CreatePropertyGUI(SerializedProperty property)
{
VisualElement container = new();
Debug.Log("CreatePropertyGUI");
return container;
}
}
[CustomEditor(typeof(TestObject))]
public class TestObjectEditor : Editor
{
public override VisualElement CreateInspectorGUI()
{
VisualElement container = new();
Debug.Log("CreateInspectorGUI");
SerializedProperty property = serializedObject.FindProperty("_model");
container.Add(new PropertyField(property));
return container;
}
}
The problem/bug (?):
When selecting the object I get the following in the console:

The property drawer seems to be called twice, once from
UnityEditor.InspectorWindow:RedrawFromNative ()
and once from
UnityEditor.RetainedMode:UpdateSchedulers ()
The question:
This behavior causes some serious rendering hiccups in more complicated structures and I was wondering if this should be considered normal bahavior? What improvements could I make to save the second call?
I’m using Unity 2022.3.22f1
Thank you!
1 Like
This doesn’t seem correct. I cannot repro on the latest alpha though. Could you submit a bug report about this (Help>Report a bug…) Thanks!
Hello,
Has a ticket been opened for that?
I’m witnessing the same behaviour with a CustomPropertyDrawer.
In my case the callers are :
UnityEngine.GUIUtility: ProcessEvent (int,intptr,bool&) (EDIT: added a space to avoid displaying a smiley)
and
UnityEditor.RetainedMode:UpdateSchedulers ()
Also Unity 2022.3.22f1
1 Like
Hello there!
Spotted similar issue: one call of PropertyDrawer constructor and three calls of CreatePropertyGUI(). Two calls from UnityEditor.InspectorWindow:RedrawFromNative() and the last from UnityEditor.Selection:Internal_CallSelectionChanged ()
I have a custom UIToolkit Editor and a custom PropertyDrawer.
Interesting that a result of last call is discarded: in the Inspector we are looked at a VisualElements from a second call.
This behaviour is ruining my attempts to cache some newly created elements because I store in property drawer class fields VisualElements that are not present on the screen actually.
Checked on Unity 2022.3.22, 2022.3.28 and Unity 6000.0.1f Preview
1 Like
Exactly living that problem. Seems like a bug that occur inside a serious implementation of code chains.
I can’t find any bug report about this yet, could any of you submit a repro please? This can be done in Help>Report a bug… It will allow our QA to investigate all supported unity versions for the defect.
1 Like
Yep, submitted a repro for the issue, jira id IN-76077
1 Like
Bug report was confirmed and transferred to development team, id UUM-72452
1 Like
Bug in the Unity issue tracker
Hello!
I’m currently facing this exact same problem yeah, it’s kinda annoying and I don’t know how to get rid of it…
I’ll try to find a ‘patch’ or a ‘bypass’ to see if I can avoid it…