You tell us what the problem is then somebody might correct it.
using UnityEngine;
using System.Collections;
public class Coin : MonoBehaviour
{
float Coins = 0;
void OnTriggerEnter2D (Collider2D Other)
{
print ("Hello");
Coins += 1;
}
}
OnGUI ()
{
GUI.Label(new Rect(10, 10, 100, 30), "COINS:" + ((Coins));
}
There are a lot of mistakes but
is too little information, I doubt anybody is going to spend time trying to guess what you are adding coins to or what this script is attached to or what the errors are etc…
You probably have a compile error with that wrongly prototyped OnGUI outside of the class, for other issues you have to explain further what the problem is, like softwizz suggested…
using UnityEngine;
using System.Collections;
public class Coin : MonoBehaviour
{
float Coins = 0;
void OnTriggerEnter2D (Collider2D Other)
{
print ("Hello");
//Maybe add: if (other.tag == "coin") or something similar to identify the other collider
//or set you physics layer properly
Coins += 1;
}
void OnGUI ()
{
GUI.Label(new Rect(10, 10, 100, 30), "COINS:" + Coins.ToString());
}
}