using UnityEngine; public class CoinScript : MonoBehaviour { public GameManager gameManager; public Vector3 RotatingSpeed; // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { } // Update is called once per frame void Update() { transform.Rotate(RotatingSpeed); } void OnTriggerEnter(Collider other) { if(other.tag=="Ball") { Destroy(gameObject); gameManager.AddCoins(); } } }