Advertisement
Nemomen101

First Game Hit Script

Jan 18th, 2025
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | Source Code | 0 0
  1. using UnityEngine;
  2.  
  3. public class ObjectHit : MonoBehaviour
  4. {
  5. private void OnCollisionEnter(Collision other)
  6. {
  7. if (other.gameObject.tag == "Player")
  8. {
  9. GetComponent<MeshRenderer>().material.color = Color.black;
  10. gameObject.tag = "Hit";
  11. }
  12.  
  13. }
  14. }
  15.  
Tags: Hit Script
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement