Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

266
Visualizações
Unity C# What does the funtion Application.CanStreamedLevelBeLoaded(String string) do?

in the ARFoundation Unity samples I found the following code snippet:

public void BackButtonPressed()
        {
            if (Application.CanStreamedLevelBeLoaded("Menu"))
            {
                SceneManager.LoadScene("Menu", LoadSceneMode.Single);
                LoaderUtility.Deinitialize();
            }
        }

Can somebody please explain to me when and why to use Application.CanStreamedLevelBeLoaded(String string)? In the Unity docs I found this as explanation: Can the streamed level be loaded?

But that tells me nothing.

And when and why should one also use LoadSceneMode.Single and LoaderUtility.Deinitialize()? I found this for LoaderUtility.Deinitialize(): Deinitializes the currently active XR Loader, if one exists. This destroys all subsystems.

I appreciate any help. Thanks!

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Application.CanStreamedLevelBeLoaded does exactly what you think it should do when reading the function name, it checks if the streamed level can be loaded. Use it BEFORE attempting to actually load a streamed level. Streamed in this case means downloading the level for the WebGL client. The progress of the stream means how far the download of your level has progressed.

Use this function to check the download state, just like you see in the doc example, to prevent an exception when trying to load an unfinished level.

Behind the scenes it uses a float called downloadProgress of the UnityWebRequest to determine if the file is downloaded.

https://docs.unity3d.com/ScriptReference/Networking.UnityWebRequest-downloadProgress.html

Deeper down you will most probably find a FileStream, hence the name of the function.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda