I want to make GUI for displaying collected items.
Here is a code:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class CollectedItems : MonoBehaviour {
public GameObject item;
void Items()
{
item = GameObject.Find ("Kanister");
string itmTxt = "Zebrano: "
+ item;
GUI.Box (new Rect (Screen.width / 2, Screen.height / 2, 200, 200), itmTxt);
}
}
And also code for collecting items:
using UnityEngine;
using System.Collections;
public class AnotherCollectables : MonoBehaviour {
void OnTriggerEnter2D(Collider2D collider)
{
switch (collider.gameObject.name)
{
case "Player":
Destroy (this.gameObject);
break;
}
}
}
PS im using my native language in script as “Kanister” or "Zebrano: " they mean GasCan and Collected