Button Fix!

1 day left for the jury and I solved the touch/ button issue. With a little help from our TA Servet Ulaş I was able to edit the script correctly and get the getTouch command working. the buttons are now used for changing the scene with the touch input.

here the code:

var shot:Transform;
var recoveryTime = 10;

private var delay = 0;

function Update () {
if (delay>0){delay -=1;}

if (delay==0){
if(Input.touchCount == 1){
var currentTouch:Touch = Input.touches[0];

if(currentTouch.phase == TouchPhase.Began && guiTexture.HitTest(currentTouch.position)){
Application.LoadLevel (1);
delay = recoveryTime;
} print (currentTouch.phase);    //



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: