Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

265
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!