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. Dismiss Notice

Question Possible to focus the editor Game window on Play with Code?

Discussion in 'Editor & General Support' started by zedz, May 29, 2023.

  1. zedz

    zedz

    Joined:
    Aug 31, 2013
    Posts:
    228
    A pretty minor thing, so not important

    But I want to simulate clicking on the window when I press play in the editor
    because at the moment
    Mouse.current.position.ReadValue() returns wrong values until I first click on the window

    I thought
    UnityEditor.EditorWindow.focusedWindow.Focus();
    would do it but No.

    BTW I have GameWindow > Play Focused selected from the dropdown menu.

    Like I said minor, just a minor anoyance. Cheers
     
    Last edited: May 29, 2023