Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Nominations have been announced for this years Unity Awards. Celebrate the wonderful projects made by your peers this year and get voting! Vote here!
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

How to convert keyboard keys into mobile touch?

Discussion in '2D' started by musictree555, Dec 6, 2018.

  1. musictree555

    musictree555

    Joined:
    Dec 6, 2018
    Posts:
    1
    Hi,

    I am duplicating a guitar hero alike game on unity 2d but to be exported into an apk file. How am i able to change the codes to allow input touch on mobile? As of now, each block on unity 2d is binded to an alphabet key on my keyboard.

    void Update (){
    if(createMode){

    if (Input.GetKeyDown(key))
    Instantiate(n, transform.position, Quaternion.identity);
    }else{

    if (Input.GetKeyDown(key))
    StartCoroutine(Pressed());

    if (Input.GetKeyDown(key) && active){
    Destroy(note);
    AddScore();
    active = false;
    }

    }
    }