Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Increased GC Alloc in PropertyDrawer with Repaint

Discussion in '2023.1 Beta' started by Kazko, Feb 27, 2023.

  1. Kazko

    Kazko

    Joined:
    Apr 2, 2014
    Posts:
    82
    Hi, when calling Repaint in PropertyDrawer (to achieve responsive Inspector), the GC Alloc raises from 277 B to about 20 kB in Unity versions 2020 - 2022.2. That's normal and happens even with a drawer with no layout.

    Code (CSharp):
    1. [CustomPropertyDrawer(typeof(RepaintTest))]
    2. public class RepaintTestDrawer : PropertyDrawer
    3. {
    4.   public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    5.   {
    6.     EditorWindow.focusedWindow.Repaint();
    7.   }
    8. }
    However since 2023.1 Beta this overhead jumps 3x to 60 kB.

    Is this due to transition to UITK or could it be a bug? Thanks for any ideas.
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,899
    Hi,
    It could be due to the UI toolkit transition although it would be nice to not regress performance with this change. Could you please file a bug report so we we can look unity it?