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

Input does not work in Unity 5.5.0p4

Discussion in 'Scripting' started by trollingchar, May 7, 2017.

  1. trollingchar

    trollingchar

    Joined:
    Mar 21, 2017
    Posts:
    2
    Greetings. I use Unity 5.5.0p4. I have a script that allows the user to drag camera with right mouse button. Code is simple:
    Code (CSharp):
    1. if (Input.GetMouseButtonDown(1)
    2.     camera.controller = new MouseBasedCameraController(camera);
    (Variable "camera" is a wrapper for Unity camera)

    Script with this code is attached to a valid, enabled GameObject and is called from its Update method. I tested it in editor and it works.
    Then I compiled the game for WebGL and this did not work.

    I changed the code:
    Code (CSharp):
    1. if (Input.GetMouseButtonDown(1) {
    2.     camera.LookAt(400, 400);
    3.     Debug.Log("works");
    4. }
    So if condition is true, camera looks at empty space and debug console shows the word "works" and I can say does input work or not. I tested different types of input and there are results:
    • Clicking GUI Buttons, typing text in Input Fields: works both in editor and WebGL.
    • Input.GetMouseButton, GetMouseButtonDown, GetMouseButtonUp, mousePosition: works in editor, does not work in WebGL (all buttons).
    • Input.GetKey, GetKeyDown, GetKeyUp: does not work at all, debug console shows nothing.
    How to solve my problem?
     
  2. GLeBaTi

    GLeBaTi

    Joined:
    Jan 12, 2013
    Posts:
    47
    Do you solve this problem?