Files
GameDevTVObstacleDodge/Assets/Scripts/ObjectHit.cs

14 lines
299 B
C#
Raw Normal View History

2026-01-08 16:50:20 +00:00
using UnityEngine;
public class ObjectHit : MonoBehaviour
{
private void OnCollisionEnter(Collision other)
{
if (other.gameObject.tag == "Player")
{
GetComponent<MeshRenderer>().material.color = Color.black;
gameObject.tag = "Hit";
}
}
}