Hi there!
I’m trying to make a loading system where I load a loading scene first and then I load the new scene asyncrounosly with it’s loading bar and stuff.
My script is this one:
public string Scene, loadingScene;
Scene sScene;
AsyncOperation asyn;
void Start ()
{
DontDestroyOnLoad (this);
}
void Update ()
{
sScene = SceneManager.GetActiveScene ();
if (sScene.name == loadingScene)
{
LoadScene (Scene);
}
}
public void LoadLoadingScene()
{
SceneManager.LoadScene (loadingScene);
}
public void LoadScene(string ss)
{
SceneManager.LoadSceneAsync (ss);
Slider s = GameObject.Find ("BarraCarga").GetComponent<Slider> ();
s.value = asyn.progress;
}
public void ChangeString (string s)
{
Scene = s;
}
I put the function to load my scene on update, to check when I’m on my loading scene, but the issue is that in update I call this funcion like a hundred of times, and I want to know how call it just once o another way to do this.
Thanks you all sorry for my bad english xD