- Home /
Question by
Nivethan96 · Oct 10, 2016 at 09:24 PM ·
uiguitext
Score wont show
Hi i have problem with my script ... I am making a similer game = https://www.youtube.com/watch?v=8uXj7yk9z1I&list=PLQzQtnB2ciXQFA1xqmmu0UJgdApFS5W5o∈dex=4 but can not get the score count when i tap on the screen. Need help and sorry for my english.
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class touchstuff : MonoBehaviour {
int i;
public int maxFinger;
int fingerCount;
public Text Score;
void Start () {
}
void upate () {
fingerCount = 0;
foreach (Touch touch in Input.touches) {
if (touch.phase == TouchPhase.Began && fingerCount<maxFinger)
{i++;
this.GetComponent<Animator> ().SetBool ("Tapped", true);
Debug.Log(i);
}
fingerCount++;
}
Score.text = i.ToString ();
}
public void TappedFalse(){
this.GetComponent<Animator> ().SetBool ("Trapped", false);
}
}
Comment
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class touchstuff : $$anonymous$$onoBehaviour {
int i;
public int maxFinger;
int fingerCount;
public Text Score;
void Start () {
}
void upate () {
fingerCount = 0;
foreach (Touch touch in Input.touches) {
if (touch.phase == TouchPhase.Began && fingerCount<maxFinger)
{i++;
this.GetComponent<Animator> ().SetBool ("Tapped", true);
Debug.Log(i);
}
fingerCount++;
}
Score.text = i.ToString ();
}
public void TappedFalse(){
this.GetComponent<Animator> ().SetBool ("Tapped", false);
}
}
Your answer
Follow this Question
Related Questions
Simple text GUI 2 Answers
New UI Text is blurier than GUIText 2 Answers
Drawing UI text on GUI.DrawTexture , How to do it ? 1 Answer
GUI and UI compatibility 1 Answer