using Unity.VisualScripting; using UnityEngine; using System.Collections; public class Player : MonoBehaviour { public GameManager gm; public Rigidbody rb; // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { // GameManager gm = FindAnyObjectByType(); Rigidbody rb = GetComponent(); } // Update is called once per frame void OnCollisionEnter(Collision collider) { if (collider.collider.tag == "Damage") { Debug.Log("Hit!"); gm.currentHealth -= 5; } } void FixedUpdate() { } }