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

Loosing focus on webGL when interacting with ui elements

Discussion in 'UGUI & TextMesh Pro' started by adambielecki, Jul 27, 2020.

  1. adambielecki

    adambielecki

    Joined:
    Mar 28, 2014
    Posts:
    21
  2. adambielecki

    adambielecki

    Joined:
    Mar 28, 2014
    Posts:
    21
    Solution found.
    Create new class that inherits from Button class and override OnPointerDown method.

    public override void OnPointerDown(PointerEventData eventData)
    {
    base.OnPointerDown(eventData);
    Cursor.lockState = CursorLockMode.Locked
    }
     
  3. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,203