- Home /
Adding a point to a variable is making it not show.
I am creating a cookie clicker game and what happens is if I click fast enough the text that shows the score just disappears. This is the script for adding the score:
public class points : MonoBehaviour
{
[HideInInspector]
public static int score;
public void addScore()
{
score++;
}
}
and the other script is this one. Does anyone have any ideas?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class showScore : MonoBehaviour
{
Text text;
private void Start()
{
text = GetComponent<Text>();
}
public void Update()
{
text.text = "Score: " + points.score;
}
}
Comment
Your answer
Follow this Question
Related Questions
How to connect a variable to a UI text object 0 Answers
show sync var on two text ui (unet - networking) 3 Answers
Displaying variable on UI text every frame (JS) 1 Answer
Variable won't appear on UI text (JS) 0 Answers
Text UI is not being assigned 2 Answers