IEnumerator Load() { var asset = ABAssets.LoadAsync <GameObject>(assetPath); if (asset != null) { while (!asset.IsDone) { yield return(0); } var prefab = asset.asset; if (prefab != null) { var go = Instantiate(prefab) as GameObject; ReleaseAssetOnDestroy.Register(go, asset); GameObject.Destroy(go, 10); } } yield return(new WaitForSeconds(11)); asset = ABAssets.Load <GameObject>(assetPath); if (asset != null) { var prefab = asset.asset; if (prefab != null) { var go = Instantiate(prefab) as GameObject; ReleaseAssetOnDestroy.Register(go, asset); GameObject.Destroy(go, 3); } } }
public byte[] load(ref string filepath) { string path = filepath.Replace(".", "/"); path = path.Append(".lua"); path = genPath.CombinePath(path).ToAssetsPath(); var asset = ABAssets.Load <TextAsset>(path); var bytes = (asset.asset as TextAsset)?.bytes; asset.Release(); return(bytes); }