Help Touch control

Hi Guys, I am creating my Quiz App and i was watching some Tutorials.

I really try to find all the informations in Youtube, but I was creating my first Quiz for Computer. Now i want to touch instead of using the Mouse

What do I have to change on my Code. In m Tutorial we was clicking on a text - but now I want to touch on a button with the text.

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class Text1 : MonoBehaviour {

List firstchoice = new List () {“Bonn”,“Paris”,“Casablanca”,“Rom”,“St. Petersburg”};

// Use this for initialization
void Start () {
//GetComponent ().text = firstchoice [0];
}

// Update is called once per frame
void Update () {
if (TextControl.randquestion > -1)
{
GetComponent ().text = firstchoice [TextControl.randquestion];
}
}

void OnMouseDown()
{

TextControl.selectedAnswer = gameObject.name;
TextControl.choiceSelected = “y”;
}

}

would be thankful for your help

:slight_smile:

Sabrina

Hey,
you have to change nothing at all. Unity will find your OnMouseDown method during build and will enable an internal variable to process touch events just like mouse events. This will impact the performance a bit but is probably still fast enough for a quiz app.

Thank you :slight_smile: