未验证 提交 910395e7 编写于 作者: ocean2o11's avatar ocean2o11 提交者: GitHub

Update UsingAssetBundle.md

增加ab.Unload调用
上级 e72e6787
...@@ -40,7 +40,10 @@ public static void Build() ...@@ -40,7 +40,10 @@ public static void Build()
else else
{ {
AssetBundle ab = (request.downloadHandler as DownloadHandlerAssetBundle).assetBundle; AssetBundle ab = (request.downloadHandler as DownloadHandlerAssetBundle).assetBundle;
// ab.LoadAsset
ab.Unload(false);
} }
request.Dispose();
``` ```
- UnityWebRequest - UnityWebRequest
```c# ```c#
...@@ -54,7 +57,10 @@ public static void Build() ...@@ -54,7 +57,10 @@ public static void Build()
} else } else
{ {
AssetBundle ab = handler.assetBundle AssetBundle ab = handler.assetBundle
// ab.LoadAsset
ab.Unload(false);
} }
www.Dispose();
``` ```
- WWW.LoadFromCacheOrDownload - WWW.LoadFromCacheOrDownload
```c# ```c#
...@@ -66,6 +72,9 @@ public static void Build() ...@@ -66,6 +72,9 @@ public static void Build()
yield break; yield break;
} }
AssetBundle ab = www.assetBundle; AssetBundle ab = www.assetBundle;
// ab.LoadAsset
ab.Unload(false);
www.Dispose();
``` ```
- WWW - WWW
```c# ```c#
...@@ -77,6 +86,8 @@ public static void Build() ...@@ -77,6 +86,8 @@ public static void Build()
yield break; yield break;
} }
AssetBundle ab = www.assetBundle; AssetBundle ab = www.assetBundle;
ab.Unload(false);
www.Dispose();
``` ```
界面如下 界面如下
...@@ -129,4 +140,4 @@ StartCoroutine(UnityWebRequestLoad(string.Format("http://127.0.0.1:8080/Streamin ...@@ -129,4 +140,4 @@ StartCoroutine(UnityWebRequestLoad(string.Format("http://127.0.0.1:8080/Streamin
3. Understanding Memory in Unity WebGL 3. Understanding Memory in Unity WebGL
https://blog.unity.com/technology/understanding-memory-in-unity-webgl https://blog.unity.com/technology/understanding-memory-in-unity-webgl
4. AssetBundle API 4. AssetBundle API
https://docs.unity3d.com/2019.4/Documentation/ScriptReference/AssetBundle.html https://docs.unity3d.com/2019.4/Documentation/ScriptReference/AssetBundle.html
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册