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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Calling repaint on eg. EditorWindow interferes with mouse input in eg. Game view.

Discussion in 'Editor & General Support' started by JeffersonTD, Apr 2, 2020.

  1. JeffersonTD

    JeffersonTD

    Joined:
    Feb 5, 2013
    Posts:
    267
    I want to force a repaint for an EditorWindow. Well, repaint does the job. The problem is that it does more than that. Whenever I call Repaint() and have left mouse button down, Input.GetMouseButton(0) within a MonoBehaviour starts returning false even though the mouse button is down (and Input.GetMouseButtonUp(0) never happens in between).

    I'm not sure if this applies to all unity versions. Unity version in this case is 2018.4.17f1. Is there some not-hacky way of dealing with this?
     
  2. JeffersonTD

    JeffersonTD

    Joined:
    Feb 5, 2013
    Posts:
    267
    Ok, found how to fix this with some extra logic for my purpose. When using Repaint, simply having this line of code
    UnityEditor.SceneView sceneView = GetWindow<SceneView>();
    makes the game scene's mouse input break. This happens in 2019.3 too.