- Home /
Problem in loading death menu scene
I am facing a problem in my 3d project, I have 3 scenes Main Menu, Game, Death Menu When clicking play in Main menu it switches to game scene for about second then I get the Death Menu, I checked the code it's correct also there is no errors in the console about this problem, and i tried to copy scenes to a new project and still have the same problem what should i do
void OnTriggerEnter(Collider other) {
if (other.tag == "Wall") {
SceneManager.LoadScene ("Death");
}
this code i put in player for death
death code: using System.Collections; using UnityEngine.UI; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class Death : MonoBehaviour {
private ScoreManger theScoreManger;
void Start () {
theScoreManger = FindObjectOfType<ScoreManger> ();
theScoreManger.scoreIncreasing = false;
}
public void ToMain () { SceneManager.LoadScene ("main menu"); } }
SceneManager.LoadScene ("Death");
}
Looks like your Game scene might be starting with the player's trigger intersecting a wall.
Also, you can put "Debug.Log("Death");" statements just above any "Scene$$anonymous$$anager.LoadScene ("Death");" statements, to see in which part of the code the transition is happening.
try adding a Debug.Log("Death Scene was triggered");
in your OnTriggerEnter if it does print in the console, then it means you're triggering the OnTriggerEnter, maybe your player is already touching some object with the tag wall where you spawn the player.
@rhylvin2016 it was working correctly, one week later i opened the project to put an audio this problem happened