Search Unity

mobile constantly updating finger position

Discussion in '2D' started by pwndoog121, Oct 3, 2019.

  1. pwndoog121

    pwndoog121

    Joined:
    Sep 24, 2019
    Posts:
    2
    Hey im working on a game, the game is a puzzle game with about 14 squares, in a grid formation, the player can touch anywhere on the screen and move their finger around and when they move their finger over a clickable square the square changes sprites.

    How could this be achievable with finger touches, currently im using OnMouseDown() but that means the player has to put their finger down on a square and then back up to be able to touch another square.
     
  2. MisterSkitz

    MisterSkitz

    Joined:
    Sep 2, 2015
    Posts:
    833
    I would imagine what you're looking for is:

    Code (CSharp):
    1. Input.GetMouseButton(0)// for left click
    2.  
    3. Input.GetMouseButton(1)// Right click
    I think this should register the length of "Pressed" whereas GetMouseDown() fires only once when pressed down then the event is over. GetMouseUp() fires once when the button is released. However, GetMouseButton() should fire constantly during the down event and stops when released.