using System.Collections; using System.Collections.Generic; using UnityEngine; public class PickupController : MonoBehaviour { private ScoreManager scoreManager; private void Start() { scoreManager = GameObject.Find("Canvas").GetComponent(); } private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { scoreManager.score += 1f; Destroy(gameObject); } } }