Main.coin+=10; GameObject obj=GameObject.[[Instantiate]](getCoinText, new Vector2( end.x,end.y ), Quaternion.identity) as GameObject; obj.GetComponent<TextMesh>().text="10coins"; obj.GetComponent<MeshRenderer>().sortingLayerName = "UI";
public class getCoinText : MonoBehaviour {
int count=70;
void Update () {
count--;
if(count<=0)
Destroy(gameObject);
transform.Translate( new Vector3(0,0.02f,0) );
}
}