using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class wastafel : MonoBehaviour
{
public Text ctText;
public static int iscucitangan;//scoring
public int handwash;
void update()
{
handwash = iscucitangan;
ctText.text = "Sudah cuci tangan :" handwash;
}
}
I tried this script to display a scoring system I made in unity (I use this video as reference : https://www.youtube.com/watch?v=YKeXyaB41EA). I applied this code to a text UI object in my program like this. This is the CT text object. But when I press play, it came up like this, no change at all. This is my text setting. Is there something that I miss?
CodePudding user response:
It is caused because of the typo, it should be Update()
with a capital U
and not update()
.
CodePudding user response:
First thing first, have you assigned ctText in inspector? Then... how is your scoring variable being updated?