- Home /
Question by
AndrewBrown123 · Aug 14, 2018 at 01:59 PM ·
assetsave scenesave-to-filesavegame
Easy Save Loading
Hello, I bought Easy Save 2 from the assets store only because I never worked with saving before and I wanted something easier. I'm stuck trying to load levels in my game. My first level is unlocked because it is suppose to but every other level is locked and will not unlock.
Here is the code I have so far...
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class levelSelect : MonoBehaviour {
public Button tutorialLevel, Level1, Level2, Level3, Level4, Level5;
public GameObject LoadingScreen;
public Slider slider;
public string levelToLoad;
void Start(){
Level1.interactable = false;
Level2.interactable = false;
Level3.interactable = false;
Level4.interactable = false;
Level5.interactable = false;
}
public void Load(){
string[] filesInFolder = ES2.GetFiles("onlyMoveRightGame");
if(ES2.Exists("saveScene1")){
Level1.interactable = true;
Debug.Log("Why Are You Not Working???");
}
levelToLoad = ES2.Load<string>("SavedScene");
StartCoroutine(LoadAsynchronously());
}
IEnumerator LoadAsynchronously(){
AsyncOperation operation = SceneManager.LoadSceneAsync(levelToLoad);
LoadingScreen.SetActive(true);
while(!operation.isDone){
float progress = Mathf.Clamp01(operation.progress / .9f);
slider.value = progress;
yield return null;
}
}
}
I looked though the Easy Save 2 API and well it is vary good and helpful I just don't know what I'm doing right or wrong. Any help on this is appreciated this is the last major thing I have to do for my game. I hope I made this clear as possible. Thank You.
Comment