Hello,
When I run my script after loading the scene with a TMP UI Button it crashes:
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
or
SceneManager.LoadScene("Test");
When load the scene from another scene either with or without a button it does not crash:
void Start()
{
//SceneManager.LoadScene("Test");
}
public void Test()
{
SceneManager.LoadScene("Test");
}
Note- I used loadscenemode.single and it does not work; It does not crash from the scene loading itself, but rather when I use a script after loading the scene. I am pretty sure that the other script used after the load does not relate because it only triggers in this specific situation.
I’ve also tested it as a build and it crashes then too. Can anyone help me fix this issue? Thanks to any help.
What does the console say?
What does the log file say? Unity - Manual: Log files
The editor crashes before i can see the console
Then what does the editor log say?
Upload the file. Don’t just dump the text here, especially as a forum post can’t have that many characters in it.
Add a Debug.Log wherever you’re loading a scene to see how many times your loading the scene, and to verify it’s the right scene.
I only load it once, and it doesn’t crash until I interact with any scripts
To be fair, looking at your code here:
void Start()
{
//SceneManager.LoadScene("Test");
}
Were you loading the same scene with this? This will just go infinite and indeed crash the editor.
spiney199:
To be fair, looking at your code here:
void Start()
{
//SceneManager.LoadScene("Test");
}
Were you loading the same scene with this? This will just go infinite and indeed crash the editor.
Yeah I used this (not commented) in another script and another scene, it did not crash like it does from the same scene with:
public void ResetScene()
{
Debug.Log("1");
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
used on a TMPro UI button
I fixed it by removing a while loop from another script. Not sure why it is connected but thanks for the help