Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Level : MonoBehaviour {
- int numTreasures;
- int collected = 0;
- // Use this for initialization
- void Start () {
- GameObject[] treasureObjects = GameObject.FindGameObjectsWithTag("Treasure");
- numTreasures = treasureObjects.Length;
- }
- void TreasureCollected()
- {
- collected++;
- }
- void OnGUI()
- {
- GUI.skin.label.fontSize = 20;
- GUI.Label(new Rect(10, 40, 200, 30), "Treasures: " + collected + "/" + numTreasures);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment