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 are updating our Terms of Service for all Unity subscription plans, effective October 13, 2022, to create a more streamlined, user-friendly set of terms. Please review them here: unity.com/legal/terms-of-service.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Resolved Updating Input.mousePosition when not focused

Discussion in 'WebGL' started by popMark, Jun 24, 2021.

  1. popMark

    popMark

    Joined:
    Apr 14, 2013
    Posts:
    113
    Is it possible to keep unity updating the mouse position when unity is not the focused element? Currently when something else takes focus mouse pointer stops updating
     
    Last edited: Jun 25, 2021
  2. popMark

    popMark

    Joined:
    Apr 14, 2013
    Posts:
    113
    EventSystem as a flag
    m_HasFocus
    which is set false when the canvas loses focus and in the Update loop it returns early if it's false.
    I made a class that extends EventSystem and has an override for
    OnApplicationFocus
    that just doesnt call the base method

    Code (CSharp):
    1. public class BetterEventSystem : EventSystem
    2. {
    3.     protected override void OnApplicationFocus(bool hasFocus)
    4.     {
    5.         //base.OnApplicationFocus(hasFocus);
    6.     }
    7. }
     
unityunity