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

Resolved Updating Input.mousePosition when not focused

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

  1. popMark

    popMark

    Joined:
    Apr 14, 2013
    Posts:
    114
    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:
    114
    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. }