- Home /
Weird LoadLevel Error
Hello,
EDIT the language is c#
I've been getting random errors whenever I try to do normal unity operations such as loadnig a level, the sendmessage command, etc. I have fixed all the other errors but i do not know how to get around this one.
Basically its just the red error message with this text: UnityEngine.Application:LoadLevelAsync(String, Int32, Boolean, Boolean) UnityEngine.Application:LoadLevel(String) (at C:\BuildAgent\work\6bc5f79e0a4296d6\Runtime\ExportGenerated\Editor\BaseClass.cs:1492)
Thats it. I am using loadlevel, not loadlevelasync. The line of code is this:
Application.LoadLevel("CharacterSelectionScreen")
That's a correct name of the scene; but this error.
Please help :)
Thanks, Christian
Answer by unfoundfate · Nov 24, 2011 at 09:38 PM
I had this same issue. I fixed it by adding a boolean that was checked in my update function so it was the first thing that ran in my next frame.
private void someFunction()
{
// Bla bla bla
loadLevel = true
}
void Update()
{
if (loadLevel)
{
locadLevel = false;
Application.LoadLevel(2);
}
}
I searched for hours trying to figure out why it wouldn't load but others said that it is ran at the end of the frame? Its a work around but it works. Also not sure if you were trying to run it from a static function but that could have done it to.
Basically it HAS to be in 1 of the Unity functions.
Interesting, I myself have never had this error, my only comment on your code is that you mistyped the variable name on line 11.
Your answer
![](https://koobas.hobune.stream/wayback/20220612133401im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Help please guys thank you so much! 1 Answer
Distribute terrain in zones 3 Answers
What is the error? 2 Answers
OnDestroy() : Some objects were not cleaned up when closing the scene 1 Answer