Canvas for examples with next and prev scene button

This commit is contained in:
2016-04-17 18:20:25 +06:00
parent c1d521e96a
commit 8d5a177eb1
15 changed files with 4284 additions and 3040 deletions

View File

@@ -0,0 +1,47 @@
using UnityEngine;
using UnityEngine.UI;
#if UNITY_5_3_OR_NEWER
using UnityEngine.SceneManagement;
#endif
namespace IsoTools.Examples {
public class SceneController : MonoBehaviour {
public Button NextSceneBtn = null;
public Button PrevSceneBtn = null;
public string NextSceneName = string.Empty;
public string PrevSceneName = string.Empty;
public void OnValidate() {
if ( !NextSceneBtn || !PrevSceneBtn ) {
Debug.LogError("SceneController. Wrong description!");
}
}
public void Start() {
if ( NextSceneBtn ) {
NextSceneBtn.interactable = !string.IsNullOrEmpty(NextSceneName);
}
if ( PrevSceneBtn ) {
PrevSceneBtn.interactable = !string.IsNullOrEmpty(PrevSceneName);
}
}
public void NextScene() {
#if UNITY_5_3_OR_NEWER
SceneManager.LoadScene(NextSceneName);
#else
Application.LoadLevel(NextSceneName);
#endif
}
public void PrevScene() {
#if UNITY_5_3_OR_NEWER
SceneManager.LoadScene(PrevSceneName);
#else
Application.LoadLevel(PrevSceneName);
#endif
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 41e9e082b17d042ac8fcff96b7e74529
timeCreated: 1460893580
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: