Search Unity

Unity Crashes with Application.LoadLevel(1)

Discussion in 'Scripting' started by SomehowLuke, Nov 11, 2015.

  1. SomehowLuke

    SomehowLuke

    Joined:
    Nov 11, 2015
    Posts:
    34
    Hello there,
    I have a strange problem. Here is my simplifed tested code:

    Code (CSharp):
    1. private bool m_bLevelLoading;
    2.     void Update()
    3.     {
    4.         if (!m_bLevelLoading)
    5.         {
    6.             m_bLevelLoading = true;
    7.             Application.LoadLevel(1);
    8.         }
    9.  
    10.     }
    When I start this (I deleted all other code from Start and other functions) Unity Crashes.



    I tried

    Application.LoadLevelAsync(1)

    and that works just fine. What am I doing wrong? Of Course I can use Async instead but i was still wondering why it does not work.

    Thank you for your help,
    best regards!
     

    Attached Files: