Search Unity

Switching Between Two Scenes

Discussion in 'Scripting' started by ezoran17, Nov 12, 2017.

  1. ezoran17

    ezoran17

    Joined:
    Nov 12, 2017
    Posts:
    2
    Hello all,

    I'm currently having some troubles switching back and forth between two scenes. In my first scene (which acts as a board holding all units), I use the SceneManager.LoadScene to load the next scene on a collision. This leads to a fight scene, and the goal is that when on player kills the other, the Board scene gets reloaded. The problem is that when the condition is met, the fight scene just reloads itself instead of going to the previous scene. I do have both scenes added to the build settings fyi. Any advice would be appreciated.

    Heres the first script loading into the fight scene
    Screenshot 2017-11-12 16.08.39.png

    Heres the second script loading the previous scene
    Screenshot 2017-11-12 16.12.05.png
     
  2. Nitrousek

    Nitrousek

    Joined:
    Jan 31, 2016
    Posts:
    38
    Well, what do the debug messages tell you?
    If the index is wrong, you need to fix the playerprefs
     
  3. ezoran17

    ezoran17

    Joined:
    Nov 12, 2017
    Posts:
    2
    Figured out the problem, and it's definitely been holding me up for like a week haha thanks though!