From 33eb72f0c1730c88a2ea67a7ca5857f745d2a801 Mon Sep 17 00:00:00 2001 From: j-hirose Date: Wed, 24 Apr 2019 18:30:17 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3?= =?UTF-8?q?=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/VRM/UniGLTF/Scripts/IO/TextureLoader.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Assets/VRM/UniGLTF/Scripts/IO/TextureLoader.cs b/Assets/VRM/UniGLTF/Scripts/IO/TextureLoader.cs index 107c566bb..6ba3cfee0 100644 --- a/Assets/VRM/UniGLTF/Scripts/IO/TextureLoader.cs +++ b/Assets/VRM/UniGLTF/Scripts/IO/TextureLoader.cs @@ -271,6 +271,23 @@ namespace UniGLTF { var url = "file:///" + tmp.Replace("\\", "/"); Debug.LogFormat("UnityWebRequest: {0}", url); +#if UNITY_2017_1_OR_NEWER + using (var m_uwr = UnityWebRequestTexture.GetTexture(url, true)) + { + yield return m_uwr.SendWebRequest(); + + if (m_uwr.isNetworkError || m_uwr.isHttpError) + { + Debug.LogWarning(m_uwr.error); + } + else + { + // Get downloaded asset bundle + Texture = ((DownloadHandlerTexture)m_uwr.downloadHandler).texture; + Texture.name = m_textureName; + } + } +#elif UNITY_5 using (var m_uwr = new WWW(url)) { yield return m_uwr; @@ -291,6 +308,7 @@ namespace UniGLTF Texture = m_uwr.textureNonReadable; Texture.name = m_textureName; } +#endif } } }