Created
October 30, 2019 16:00
-
-
Save ssabii/d5fd0824700d340a59671509f86cb83c to your computer and use it in GitHub Desktop.
에셋번들 Unload(true) 예제
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 UnityEngine; | |
using UnityEngine.Networking; | |
public class UnloadTrue : MonoBehaviour | |
{ | |
void Start() | |
{ | |
StartCoroutine(LoadAssetBundleUnloadTrue()); | |
} | |
IEnumerator LoadAssetBundleUnloadTrue() | |
{ | |
string uri = "file:///" + Application.dataPath + "/AssetBundles/bundle"; | |
UnityWebRequest request = UnityWebRequest.GetAssetBundle(uri); | |
yield return request.SendWebRequest(); | |
AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(request); | |
GameObject[] prefabs = bundle.LoadAllAssets<GameObject>(); | |
foreach(GameObject prefab in prefabs) | |
Instantiate(prefab); | |
yield return new WaitForSeconds(0.01f); | |
bundle.Unload(true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment