35 lines
No EOL
747 B
C#
35 lines
No EOL
747 B
C#
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
using System.Collections;
|
|
using UnityEngine.UI;
|
|
|
|
public class SceneLoader : MonoBehaviour {
|
|
|
|
Text buttontext;
|
|
|
|
public void Start()
|
|
{
|
|
buttontext = GetComponentInChildren<Text> ();
|
|
}
|
|
|
|
public void LoadScene()
|
|
{
|
|
string scenetext = buttontext.text;
|
|
Debug.Log (" " + scenetext);
|
|
|
|
switch (scenetext) {
|
|
case "Home":
|
|
if (!(SceneManager.GetActiveScene ().name == "Main"))
|
|
SceneManager.LoadScene ("Main");
|
|
break;
|
|
case "Run":
|
|
if (!(SceneManager.GetActiveScene ().name == "StepCounter"))
|
|
SceneManager.LoadScene ("StepCounter");
|
|
break;
|
|
default:
|
|
if (!(SceneManager.GetActiveScene ().name == scenetext))
|
|
SceneManager.LoadScene (scenetext);
|
|
break;
|
|
}
|
|
}
|
|
} |