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

cursor issue in Android

Discussion in 'Scripting' started by Hippiecode, Oct 14, 2015.

  1. Hippiecode

    Hippiecode

    Joined:
    Feb 13, 2012
    Posts:
    110
  2. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    1,256
  3. Hippiecode

    Hippiecode

    Joined:
    Feb 13, 2012
    Posts:
    110
    hi chris..
    i connected external mouse to my device through bluetooth .So On/Off cursor whenever i want.(Screen.showCursor=false).As your reply how to make my own.do you have any references for that.
     
  4. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    1,256
    Does the mouse actually work?

    I have not done it myself but I would get the mouse position and place an image at that point every update.
     
  5. Hippiecode

    Hippiecode

    Joined:
    Feb 13, 2012
    Posts:
    110
    can you provide sample package for that.
     
  6. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    1,256
    It is very simple.

    Code (CSharp):
    1. void Update()
    2. {
    3.     transform.position = Camera.main.ScreenToWorldPoint(Input.mousePosition);
    4. }
    Put that on a GameObject that has a sprite of the cursor image.
     
  7. Hippiecode

    Hippiecode

    Joined:
    Feb 13, 2012
    Posts:
    110
    Chris thanks for your reply.
    i will send a image just watch it.Here my problem is,hide the bluetooth connected mouse cursor.
     

    Attached Files:

  8. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    1,256
    Like I wrote. Use Cursor.visible = false instead if you are using 5.2. If that doesn't work than Unity probably doesn't support it on Android or its bugged.

    Why do you want to use a mouse on an Android device anyway?
     
    Who-am-I likes this.
  9. Who-am-I

    Who-am-I

    Joined:
    Mar 29, 2014
    Posts:
    73
    Actually, Android OS does not allow to hide cursor when mouse connected with device via Bluetooth.
     
  10. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    722