Search Unity

iPhone touches began

Discussion in 'iOS and tvOS' started by xcoder, Nov 23, 2009.

  1. xcoder

    xcoder

    Joined:
    Sep 26, 2009
    Posts:
    7
    Hi All,

    I want to move the player, on the users touch.
    If user touch on the GUI button, I want to translate the player object by some constant value.

    The player should be translate his position continuously , till the user ends his touch on the button.

    simply I want to implement the touches began and touches ended, but on the GUI button.

    OR Is there any other way to do the same thing?

    Thanks in advance.
     
  2. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    You can use GUI.RepeatButton to make a button that keeps responding as long as it is held down. You can then just use transform.Translate to move the object each frame. You will probably want to scale the movement distance by Time.deltaTime to make the movement independent of processor load.