forked from UnityTutorialsHD/Unity-Tutorial-Assets
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCountObjects.cs
More file actions
26 lines (24 loc) · 707 Bytes
/
Copy pathCountObjects.cs
File metadata and controls
26 lines (24 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class CountObjects : MonoBehaviour {
public string nextLevel;
public GameObject objToDestroy;
GameObject objUI;
// Use this for initialization
void Start()
{
objUI = GameObject.Find("ObjectNum");
}
// Update is called once per frame
void Update () {
objUI.GetComponent<Text>().text = ObjectsToCollect.objects.ToString();
if (ObjectsToCollect.objects == 0)
{
Application.LoadLevel(nextLevel);
//Destroy(objToDestroy);
objUI.GetComponent<Text>().text = "All objects collected.";
}
}
}