- Home /
what does work loading.preload thread
Crash occurs intermittently in the process of loading a scene using an addressable, but it keeps happening in the corresponding thread.
What does this thread do in Unity
I think it's a general addressable code
=====================================================================
if (SceneManager.sceneCount > 1)
{
string strOldSceneName = SceneManager.GetActiveScene().name;
if (!strOldSceneName.Equals("MainUI"))
{
AsyncOperation asyncOperationDelete = SceneManager.UnloadSceneAsync(strOldSceneName);
yield return asyncOperationDelete;
}
}
AsyncOperationHandle asyncOperationHandle = Addressables.LoadSceneAsync("sceneName", LoadSceneMode.Additive, false, 100);
yield return new WaitUntil(() => (asyncOperationHandle.PercentComplete == 1));
yield return asyncOperationHandle.Result.ActivateAsync();
SceneManager.SetActiveScene(asyncOperationHandle.Result.Scene);
Your answer
![](https://koobas.hobune.stream/wayback/20220613030936im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
ThreadCheck error in socket programming and instantiate a object!!! 1 Answer
Detecting exceptions outside of the main Unity thread 0 Answers
Physics without UnityEngine namespace 0 Answers
How does unity thread works? 0 Answers
Threads and variable lock 2 Answers