0

does anyone know where the error is? I've been looking for various solutions but I didn't get what I wanted

public static void LoadScene(int levelNum)
{
    Application.backgroundLoadingPriority = ThreadPriority.High;
    sceneToLoad = levelNum;
    SceneManager.LoadScene(loadingSceneIndex);
}

Eror : Assets\Script AR\LoadingScreenManager.cs(35,32): error CS0103: The name 'loadingSceneIndex' does not exist in the current context

and one more problem this one

private void StartOperation(int levelNum)
{
    Application.backgroundLoadingPriority = loadThreadPriority;

    operation = SceneManager.LoadSceneAsync(levelNum, loadSceneMode);

    if (loadSceneMode = LoadSceneMode.Single)
        operation.allowSceneActivation = false;
}

Eror : Assets\Script AR\LoadingScreenManager.cs(91,13): error CS0029: Cannot implicitly convert type 'UnityEngine.SceneManagement.LoadSceneMode' to 'bool'

Hafid Suhanizar
  • 89
  • 1
  • 1
  • 7

1 Answers1

1
  1. The first error happens because the variable loadingSceneIndex doesn't exist. You should plug the scene you want to load into the LoadScene function like this:

    SceneManager.LoadScene(levelNum);

    That way the LoadScene function knows which scene to load.

  2. The second error happens because in you're if statement expects a bool, but plug in loadSceneMode = LoadSceneMode.Single. That is defining loadSceneMode. Instead, use loadSceneMode == LoadSceneMode.Single instead because that will return a bool.

Note: Have you looked into using something like Intellisense so your editor can detect these errors for you. If you are using Visual Studio, this link might help.

Simonster
  • 593
  • 4
  • 10