Hello, I have little problem, Im trying to remake game in Unity and im using Scene loder between scenes, Scene Loader between scene 1 and 2 is working, but between 2 and 3 isnt working, just reload me again scene 2. I tried use different scene loaders but they didnt work etither. And in Build setting all these scenes are correctly added and named. So then what is wrong?
how do you mean? you have to code the scene loader
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class SceneLoader2 : MonoBehaviour
{
public GameObject LoaderUI;
public Slider progressSlider;
public void LoadScene(int index)
{
StartCoroutine(LoadScene_Coroutine(index));
}
public IEnumerator LoadScene_Coroutine(int index)
{
progressSlider.value = 0;
LoaderUI.SetActive(true);
AsyncOperation asyncOperation = SceneManager.LoadSceneAsync(1);
asyncOperation.allowSceneActivation = false;
float progress = 0;
while (!asyncOperation.isDone)
{
progress = Mathf.MoveTowards(progress, asyncOperation.progress, Time.deltaTime);
progressSlider.value = progress;
if (progress >= 0.9f)
{
progressSlider.value = 1;
asyncOperation.allowSceneActivation = true;
}
yield return null;
}
}
}
right, so that only loads secne 1… not any others…
yes, only one. Lot of others work this but not me
how can i send you video?
The paramter should be index
, not 1
.
Excellent, great job, thanks