Fixed button scripts.
This commit is contained in:
parent
9a4bbf5e9b
commit
7848e7ba3c
3 changed files with 22 additions and 2 deletions
Binary file not shown.
Binary file not shown.
|
@ -1,11 +1,31 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using System.Collections;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class SceneLoader : MonoBehaviour {
|
||||
|
||||
public void LoadScene(int scene)
|
||||
Text buttontext;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
buttontext = GetComponentInChildren<Text> ();
|
||||
}
|
||||
|
||||
public void LoadScene()
|
||||
{
|
||||
SceneManager.LoadScene(scene);
|
||||
string scenetext = buttontext.text;
|
||||
|
||||
switch (scenetext) {
|
||||
case "Home":
|
||||
SceneManager.LoadScene ("Main");
|
||||
break;
|
||||
case "Run":
|
||||
SceneManager.LoadScene ("StepCounter");
|
||||
break;
|
||||
default:
|
||||
SceneManager.LoadScene (scenetext);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
Reference in a new issue