Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Is it possible to stop the Mouse Middle Button input from auto scrolling in WebGL?

Discussion in 'Web' started by JohnnyConnor, Nov 12, 2023.

  1. JohnnyConnor

    JohnnyConnor

    Joined:
    Aug 10, 2020
    Posts:
    39
    In my game, the mouse middle button is designed to perform a specific action. However, clicking this button will naturally trigger the browser's auto-scrolling feature, leading to interruptions in the game experience (both visually and mechanically).
    I haven't found anything on the subject, but perhaps someone has a complex workaround for this? Worst case scenario, I will just remap this command for the WebGL build.
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    4,994
    Implement your worst case scenario. ;)

    On the web, the application is actually running inside another application (the browser) which has the first say in what it does with input received from the user. There are certain keys you cannot avoid doing what they normally do in the browser such as F1, F5, Ctrl+R, Ctrl+T and I assume it‘s the same with the mouse wheel.
     
    JohnnyConnor likes this.
  3. JohnnyConnor

    JohnnyConnor

    Joined:
    Aug 10, 2020
    Posts:
    39
    Welp, I suspected as much, just wanted to be sure given how experienced some people around here are lol. Thank you!