add scene manager.
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9ce9467b01f36d647ace156faef9cb9f
|
||||||
|
timeCreated: 1478927635
|
||||||
|
licenseType: Pro
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Binary file not shown.
@@ -0,0 +1,50 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
|
public class UddSceneManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
public static UddSceneManager instance { get; set; }
|
||||||
|
[SerializeField] string[] scenes;
|
||||||
|
[SerializeField] int sceneNo = 0;
|
||||||
|
|
||||||
|
void Awake()
|
||||||
|
{
|
||||||
|
if (!instance) {
|
||||||
|
instance = this;
|
||||||
|
} else {
|
||||||
|
Destroy(gameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
DontDestroyOnLoad(gameObject);
|
||||||
|
Load();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
if (Input.GetKeyDown(KeyCode.RightArrow)) {
|
||||||
|
Next();
|
||||||
|
} else if (Input.GetKeyDown(KeyCode.LeftArrow)) {
|
||||||
|
Prev();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Next()
|
||||||
|
{
|
||||||
|
sceneNo = (sceneNo + 1) % scenes.Length;
|
||||||
|
Load();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Prev()
|
||||||
|
{
|
||||||
|
sceneNo = (sceneNo - 1) % scenes.Length;
|
||||||
|
Load();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Load()
|
||||||
|
{
|
||||||
|
SceneManager.LoadScene(scenes[sceneNo]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 426ff762e9c02b0499e1453018ecdc94
|
||||||
|
timeCreated: 1478927673
|
||||||
|
licenseType: Pro
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Binary file not shown.
Reference in New Issue
Block a user