2075 / Unity / Unity 2D / Віконце з монетами / Монети без UI
Life на Main Camera (Screen.width, Screen.height) public static int a = 0; void OnGUI(){ GUI.color = Color.yellow; GUI.skin.box.fontSize = 34; GUI.Box(new Rect(0,0,200,50), "Coins: " + a); }
Coin на монету private string s = ""; void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player" && s != gameObject.name) { Life.a++; s = gameObject.name; Destroy(gameObject); } }
