Hello, I am trying to preload a large scene using addressables and show this on a loading scene. unity 2019.3.7f1 addressables 1.7.5 my scene is a local asset I have assigned the scene as an addressable. The download size always returns 0 asyncHandle.PercentComplete returns either 0 or 1 testing it on play mode. I suppose it shows this result because of the editor play mode? how can I test this on play mode? do I need to test this on a build? I use this code to load it Code (CSharp): public AssetReference level; float downloadSize; AsyncOperationHandle asyncHandle; void Awake() { if (Level.RuntimeKeyIsValid()) Addressables.GetDownloadSizeAsync(level).Completed += GetDownloadSize_Completed; } void GetDownloadSize_Completed(AsyncOperationHandle<long> obj) { if (obj.IsValid()) { downloadSize = obj.Result; Debug.Log("->download size: " +downloadSize); asyncHandle = Addressables.DownloadDependenciesAsync(level); asyncHandle.Completed += Preloader_Completed; } } void Preloader_Completed(AsyncOperationHandle obj) { if (obj.IsValid()) { if (obj.Result != null) { Addressables.LoadSceneAsync(level); } } } void Update() { if (asyncHandle.IsValid()) { Debug.Log("%" + asyncHandle.PercentComplete); Debug.Log(asyncHandle.PercentComplete * downloadSize); } } Thanks
I was curious about this, so I dug into their code to see how they do it. I found that they are using LoadSceneAsync under the hood, and the AsyncOperation returned by that should report its progress. Try loading your scene directly like that in editor and see what progress you get from it. Then you can tell if it's an issue with Addressables or the Editor SceneManager. return UnityEditor.SceneManagement.EditorSceneManager.LoadSceneAsyncInPlayMode(path, new LoadSceneParameters() { loadSceneMode = mode });
To make the editor behave as close to the built player as possible you would have to build you addressable groups then select "use existing build" as the play mode script. This will use the built addressables data instead of the unity editor's standard assetdatabase setup. Bear in mind that changes to your scenes won't show up in play mode if you dont rebuild the addressables