mirror of
https://github.com/BlackMATov/unity-iso-tools.git
synced 2025-12-16 14:09:00 +07:00
Canvas for examples with next and prev scene button
This commit is contained in:
47
Assets/IsoTools/Examples/Scripts/SceneController.cs
Normal file
47
Assets/IsoTools/Examples/Scripts/SceneController.cs
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/IsoTools/Examples/Scripts/SceneController.cs.meta
Normal file
12
Assets/IsoTools/Examples/Scripts/SceneController.cs.meta
Normal 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:
|
||||
Reference in New Issue
Block a user