DownloadHandlerTexture注意事项

Windows编辑器崩溃

如果URL传入的是一个空值,则会发生崩溃。

UnityWebRequest request = UnityWebRequestTexture.GetTexture(url);
yield return request .SendWebRequest();

https://issuetracker.unity3d.com/issues/editor-crashes-when-invalid-data-is-passed-into-unitywebrequesttexture-dot-gettexture

 

下载的纹理损坏

DownloadHandlerTexture creates a texture from downloaded data automatically, but if you switch scene or unload unused assets, that texture can be destroyed as unused. Depending on at what moment this happens, the behavior is non-deterministic.
Bottom line: don't use DownloadHandlerTexture if you do unload unused assets or switch scenes while download is going.

https://forum.unity.com/threads/downloadhandlertexture-crash.514484/

posted @ 2021-02-08 10:47  何文西  阅读(708)  评论(0编辑  收藏  举报