I don’t know why it does not work this is all in one sprite
Please Help Me
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Coins_display : MonoBehaviour
{
public static int coinsAmount;
private Text coinsCounter;
// Start is called before the first frame update
void Start()
{
coinsCounter = GetComponent<Text>();
coinsAmount = 0;
}
// Update is called once per frame
void Update()
{
coinsCounter.text = "Coins: " + coinsAmount;
if (Input.GetKeyDown(KeyCode.Space))
{
coinsCounter.text += 1;
}
}
}