hi idk why the text of coin is not working
the script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class GameController : MonoBehaviour {
public static GameController instance;
public GameObject gameOverText;
public bool gameOver;
public float scrollSpeed = -1.5f;
private int score;
[B]private int coin;[/B]
public Text scoreText;
[B] public Text cointext;[/B]
private void Awake()
{
if(GameController.instance == null)
{
GameController.instance = this;
}else if(GameController.instance != this)
{
Destroy(gameObject);
Debug.LogWarning("GameController ha sido instanciado por segunda vez. Esto no debería pasar.");
}
}
[B] public void Coin()
{
coin++;
cointext.text =":" + coin;
SoundSystem.instance.PlayCoin();[/B]
}
public void BirdScored()
{
if (gameOver) return;
score++;
scoreText.text = "Score: " + score;
}
public void BirdDie()
{
gameOverText.SetActive(true);
gameOver = true;
}
private void OnDestroy()
{
if(GameController.instance == this)
{
GameController.instance = null;
}
}
}
[CODE]
and then i call the method from here
[CODE]
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CoinsScore : MonoBehaviour {
private void OnTriggerEnter2D(Collider2D collider)
{
if (collider.CompareTag("Player"))
{
GameController.instance.Coin();
}
}
}
[CODE]
but the text dont change after i etner in the trigger .-.