Search Unity

Application.LoadLevel problems

Discussion in 'Scripting' started by Serellyn, Aug 28, 2012.

  1. Serellyn

    Serellyn

    Joined:
    Sep 30, 2011
    Posts:
    104
    Hey guys,

    I've got a serious problem with the Application.LoadLevel.
    So I've got 2 different scenes, added to my build.

    So first of, unity starts the first scene, as it should, that is scene 0.
    Then I call Application.LoadLevel(1) in a button.
    And it loads like it should, but it does not unload scene 0.

    Resulting in 2 levels overlapping eachother, both operational.

    So the problem is, when I load scene 1, it does not unload scene 0.

    Does anybody have any idea what the problem could be and how to resolve it?
     
  2. svenskefan

    svenskefan

    Joined:
    Nov 26, 2008
    Posts:
    282
    Hi!
    Never heard of it before.
    Are you sure that you don´t have any DontDestroyOnLoad on any of your elements in scene 0 ?
     
  3. schetty

    schetty

    Joined:
    Jul 23, 2012
    Posts:
    424
    noway to happen like this is you give the correct code. Just check it out as svenskenfan said...
     
  4. Serellyn

    Serellyn

    Joined:
    Sep 30, 2011
    Posts:
    104
    That's a really good question! I've taken this project over from a collegue of mine, and that just might be it! Thank you, I'm gonna look through it and let you know.
     
  5. Serellyn

    Serellyn

    Joined:
    Sep 30, 2011
    Posts:
    104
    And indeed, the former developer indeed had a dontdestroyonload. Thanks for the help!