using System.Collections; using System.Collections.Generic; using UnityEngine; public class Coin : MonoBehaviour { public float rotateSpeed = 180.0f; // Update is called once per frame void Update() { transform.Rotate(Vector3.up, rotateSpeed * Time.deltaTime); } private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { other.GetComponent<PlayerController>().AddScore(1); Destroy(gameObject); } } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter