using UnityEngine; using UnityEngine.UI; public class Orb : MonoBehaviour { private GameObject miniMapCamera; [SerializeField] AudioSource audioSource; private void Awake() { Canvas canvas = GetComponentInChildren(); if(miniMapCamera == null) { miniMapCamera = GameObject.Find("MiniMapCamera"); } if(canvas && canvas.renderMode == RenderMode.WorldSpace) { canvas.worldCamera = miniMapCamera.GetComponent(); } } private void OnTriggerEnter(Collider other) { if(other.gameObject.name == "Player") { //Debug.Log("Player collected an orb"); GameManager.gameManagerInstance.IncreaseOrbCounter(); audioSource.Play(); Destroy(gameObject, 0.2f); } } }