Search Unity

Bug EditorWindow repaint no longer works with DragAndDrop.

Discussion in 'Editor & General Support' started by HP, Dec 23, 2020.

  1. HP

    HP

    Joined:
    Nov 20, 2012
    Posts:
    80
    I have an EditorWindow with wantsMouseMove = true and a Repaint call.
    As soon as I drag an object from the Project Window into my window in Unity 3D 2020.2.0f1, this window is no longer redrawn until I release the mouse button. It had worked in the previous version of Unity 3D.
    I need the repaint to display an icon under the mouse pointer while dragging.

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3.  
    4. namespace PGT.GameDesignStudio
    5. {
    6.     public class TestWindow : EditorWindow
    7.     {
    8.         [MenuItem("Window/TestWindow")]
    9.         public static TestWindow Init()
    10.         {
    11.             TestWindow window = EditorWindow.GetWindow<TestWindow>(typeof(SceneView));
    12.             window.Show();
    13.             window.wantsMouseMove = true;
    14.             return window;
    15.         }
    16.  
    17.         public virtual void OnGUI()
    18.         {
    19.             GUI.Label(new Rect(10f, 10f, 300f, 16f), "MouseMove: " + wantsMouseMove + " Position: " + Event.current.mousePosition);
    20.             this.Repaint();
    21.         }
    22.     }
    23. }
    24.