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

Question How to use CursorLockMode.Locked with in-world UI (new Input System)

Discussion in 'Input System' started by jjv360, Sep 4, 2022.

  1. jjv360

    jjv360

    Joined:
    Nov 5, 2016
    Posts:
    2
    Hi, I'm using the new Input System, and my game has an in-world Canvas with some buttons on it. Without `CursorLockMode.Locked` everything works fine, but I want the player to "look at" a button and click it with the crosshair, instead of having a mouse on the screen...

    The problem is, as soon as I set `CursorLockMode.Locked` no click events are coming through to the buttons... I've also tried setting Input System UI Input Module's Cursor Lock Behavior to "Screen Center", but it doesn't help...
     
  2. jjv360

    jjv360

    Joined:
    Nov 5, 2016
    Posts:
    2
    Ok actually I solved the issue, it was actually working perfectly, but my crosshair image was capturing clicks :) ... so turning off "Raycast Target" on my crosshair image fixed it