I feel like I’m missing something obvious but my rocket instantly respawns instead of respawning only once
using UnityEngine;
using UnityEngine.SceneManagement;
public class ColliderManager : MonoBehaviour
{
private void OnCollisionEnter(Collision other)
{
switch (other.gameObject.tag)
{
case "Friendly":
Debug.Log("this is friendly");
break;
case "Obstacle":
Debug.Log("You hit the Obstacle");
break;
case "Finish":
Debug.Log("YOU WON");
break;
case "Fuel":
Debug.Log("You picked up fuel");
break;
default:
ReloadLevel();
break;
}
}
void ReloadLevel()
{
int currentSceneIndex = SceneManager.GetActiveScene().buildIndex;
SceneManager.LoadScene(currentSceneIndex);
}
}