Skip to content

Commit

Permalink
update scene loading to new Unity style
Browse files Browse the repository at this point in the history
  • Loading branch information
momo-the-monster committed Sep 20, 2018
1 parent 14aac70 commit 7a19ecd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
8 changes: 4 additions & 4 deletions Assets/Resources/DOTweenSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ MonoBehaviour:
storeSettingsLocation: 0
modules:
showPanel: 0
audioEnabled: 1
physicsEnabled: 1
physics2DEnabled: 1
spriteEnabled: 1
audioEnabled: 0
physicsEnabled: 0
physics2DEnabled: 0
spriteEnabled: 0
uiEnabled: 1
textMeshProEnabled: 0
tk2DEnabled: 0
Expand Down
14 changes: 7 additions & 7 deletions Assets/_Project/Scripts/SceneSwitcher.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;

/**
* Use Keyboard to switch between all scenes in build
Expand All @@ -19,25 +19,25 @@ void Update () {
if (Input.GetKeyDown(keyNext))
{
// Increment Scene
int nextLevel = Application.loadedLevel;
int nextLevel = SceneManager.GetActiveScene().buildIndex;
nextLevel++;
if (nextLevel >= Application.levelCount)
if (nextLevel >= SceneManager.sceneCountInBuildSettings)
{
nextLevel = 0;
}
Application.LoadLevel(nextLevel);
SceneManager.LoadScene(nextLevel);
}

if (Input.GetKeyDown(keyPrevious))
{
// Decrement Scene
int nextLevel = Application.loadedLevel;
int nextLevel = SceneManager.GetActiveScene().buildIndex;
nextLevel--;
if (nextLevel < 0)
{
nextLevel = Application.levelCount - 1;
nextLevel = SceneManager.sceneCountInBuildSettings - 1;
}
Application.LoadLevel(nextLevel);
SceneManager.LoadScene(nextLevel);
}

}
Expand Down
18 changes: 12 additions & 6 deletions ProjectSettings/EditorBuildSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@ EditorBuildSettings:
serializedVersion: 2
m_Scenes:
- enabled: 1
path: Assets/MMM/Trails/Scenes/1. Whitesnake.unity
path: Assets/_Project/Scenes/1. Whitesnake.unity
guid: 6c491acdab574f4449d85602c9ad1769
- enabled: 1
path: Assets/MMM/Trails/Scenes/2. Light Cycle.unity
path: Assets/_Project/Scenes/2. Light Cycle.unity
guid: 98b41907b99b4c1448b7b2cfe7135d58
- enabled: 1
path: Assets/MMM/Trails/Scenes/3. Enter The Mirror.unity
path: Assets/_Project/Scenes/3. Enter The Mirror.unity
guid: e833145884cdee44fa280f9f083dbda1
- enabled: 1
path: Assets/MMM/Trails/Scenes/4. The Camera Follows.unity
path: Assets/_Project/Scenes/4. The Camera Follows.unity
guid: a0add70e58f7c5c428c9e65a3f4c1422
- enabled: 1
path: Assets/MMM/Trails/Scenes/5. A Simplification.unity
path: Assets/_Project/Scenes/5. The Cinemachine Follows.unity
guid: b3b3ec43d74830147a7e7aa938d4ada8
- enabled: 1
path: Assets/MMM/Trails/Scenes/6. Texturality.unity
path: Assets/_Project/Scenes/6. Texturality.unity
guid: 70db5e0e18c2dbb45b8c80a275ffbecf

0 comments on commit 7a19ecd

Please sign in to comment.