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

What is "Input.mousePresent"?

Discussion in 'Documentation' started by asperatology, Dec 23, 2015.

  1. asperatology

    asperatology

    Joined:
    Mar 10, 2015
    Posts:
    981
    I could not find anything about Input.mousePresent at all in the Documentations.

    This is the closest thing I found so far.



    Yet it is referenced in UnityEngine itself:



    Someone suggested that it's for Android, so maybe it is that.

    While reporting this, could someone tell me what it is correctly? Thanks.
     
  2. duck

    duck

    Unity Technologies

    Joined:
    Oct 21, 2008
    Posts:
    358
    Hadn't seen this before, I will ask around!
     
  3. asperatology

    asperatology

    Joined:
    Mar 10, 2015
    Posts:
    981
    Please update once you know what it is! Thanks!
     
  4. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    792
    Maybe it returns true if the mouse is plugged in and false if it's not plugged in?
     
  5. asperatology

    asperatology

    Joined:
    Mar 10, 2015
    Posts:
    981
    Then what do you make of it for Android and iOS?

    @duck Any updates so far?
     
  6. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    792
    I wouldn't think that every variable is meant to be used on every system. Would the tilt input be usable on PC? Also, there are many other variables that are undocumented.
     
  7. duck

    duck

    Unity Technologies

    Joined:
    Oct 21, 2008
    Posts:
    358
    Ok, I've just managed to get some info about this.

    Apparently it was added back in Jan 2013, and it looks like it should be documented and publicly usable, so it's a mistake that it's marked as 'undoc' in our system.

    Under the hood, the actual implementation seems to be:
    • On Windows, Android, Metro, does actual mouse presence detection, so may be true or false.
    • On Linux, Mac, WebGL, always returns true.
    • On iOS and console platforms, always returns false
    Now that I've got this info, I'll make the page visible in the docs and update it :)
     
    GibTreaty likes this.
  8. duck

    duck

    Unity Technologies

    Joined:
    Oct 21, 2008
    Posts:
    358
    GibTreaty likes this.
  9. j_a_quent

    j_a_quent

    Joined:
    Sep 18, 2018
    Posts:
    6
    I am curious: Can this fucntion distinguish between a touchpad (as laptop's have) and a USB mouse? I tried it on Windows and it doesn't seem to. Both when I only use the touchpad as well as when the mouse is plugged in the function returns true.