-
-
Save kou-yeung/cee45275121f4b515510de486ea1c67a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using AddressableAssetsTool; | |
public class Sample : MonoBehaviour | |
{ | |
// Start is called before the first frame update | |
void Start() | |
{ | |
// set the BASE URL | |
AddressableAssets.Init("{{BASE_URL}}"); | |
// Get Preload size need to download | |
AddressableAssets.GetSizeAsync("Preload").Completed += (res) => | |
{ | |
var size = res.Result; | |
if (size > 0) | |
{ | |
// need to download update | |
var handle = AddressableAssets.DownloadDependenciesAsync("Preload"); | |
handle.Completed += (preload) => | |
{ | |
// download completed. change to next scene!! | |
}; | |
} else | |
{ | |
// no need download. change to next scene!! | |
} | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment