I dont know how to display my score with unitys new ui before i just made a gui text and added it to the script component on my player
public GUIText countText;
void OnTriggerEnter(Collider other) {
//if the object we collide with has the tag "PickUp we set its transform to inactive and
adds to our count variable
if (other.gameObject.tag == "PickUp") {
//sets the transform to inactive
other.gameObject.SetActive(false);
//adds one to our count
count += 1;
//calls our function
SetCountText();
}
}
void SetCountText(){
//creates a function that displays our score on the screem
countText.text = "Score: " + count.ToString();
}
but this no longer worked and i cant find any tutorials
– gjfcountTextneeds to be theTextcomponent of the new GUI element containing the text, not the oldGUIText. try to ensure that your code is formatted properly - it makes it easier to read. normally, i'd ignore your post because of that but i'm feeling generous today! ;)whats wrong with it thats pretty simple to read
– Eddie_ReillySeems like somebody fixed it since I commented.
– gjfIf I've answered your question could you please accept my answer.
– lolzrofl