Crossy_Road_VR/Assets/HitDetectorScript.cs
Max_Divizion 8f5aef3424 Create Menu
I have implemented the menu and in case of death, it will throw the player onto the menu stage.
2025-01-21 17:13:52 +03:00

32 lines
792 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class HitDetectorScript : MonoBehaviour
{
private void OnTriggerEnter(Collider other)
{
//Debug.Log(other.gameObject.name);
if (other.gameObject.CompareTag("Car"))
{
Debug.Log("Player was hitted car");
SceneManager.LoadSceneAsync(1);
}
}
//private void OnCollisionEnter(Collision collision)
//{
// Debug.Log(collision.gameObject.name);
//}
//private void OnControllerColliderHit(ControllerColliderHit hit)
//{
// Debug.Log(hit.gameObject.name);
// if (hit.gameObject.CompareTag("Car"))
// {
// Debug.Log("Car hitted");
// }
//}
}