I cant find the error.
CODE
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class Player : MonoBehaviour
{
public Text countText;
private int count;
public Text endText;
public GameObject player;
void Start ()
{
count = 0;
SetCountText ();
}
void OnTriggerEnter2D(Collider2D col)
{
if(col.gameObject.tag == "Coin")
{
col.gameObject.SetActive (false);
count = count + 1;
SetCountText ();
} else if (col.gameObject.tag == "Enemy")
{
Destroy(gameObject);
}
}
void SetCountText ()
{
countText.text = " " + count.ToString ();
endText.text = " " + count.ToString ();
}
}