diff --git a/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileImage.cs b/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileImage.cs index 4fb1351..072bcd4 100644 --- a/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileImage.cs +++ b/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileImage.cs @@ -5,6 +5,7 @@ using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; +using UnityEngine.Networking; using SFB; [RequireComponent(typeof(Button))] @@ -46,8 +47,16 @@ private void OnClick() { #endif private IEnumerator OutputRoutine(string url) { - var loader = new WWW(url); - yield return loader; - output.texture = loader.texture; + UnityWebRequest www = UnityWebRequestTexture.GetTexture(url); + yield return www.SendWebRequest(); + + if (www.result != UnityWebRequest.Result.Success) + { + Debug.LogError(www.error); + } + else + { + output.texture = ((DownloadHandlerTexture)www.downloadHandler).texture; + } } } \ No newline at end of file diff --git a/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileText.cs b/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileText.cs index 39cb2f4..29b9de8 100644 --- a/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileText.cs +++ b/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileText.cs @@ -5,6 +5,7 @@ using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; +using UnityEngine.Networking; using SFB; [RequireComponent(typeof(Button))] @@ -46,8 +47,16 @@ private void OnClick() { #endif private IEnumerator OutputRoutine(string url) { - var loader = new WWW(url); - yield return loader; - output.text = loader.text; + UnityWebRequest www = UnityWebRequest.Get(url); + yield return www.SendWebRequest(); + + if (www.result != UnityWebRequest.Result.Success) + { + Debug.LogError(www.error); + } + else + { + output.text = www.downloadHandler.text; + } } } \ No newline at end of file diff --git a/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileTextMultiple.cs b/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileTextMultiple.cs index 61b35b2..cd03761 100644 --- a/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileTextMultiple.cs +++ b/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileTextMultiple.cs @@ -1,10 +1,9 @@ -using System.Text; using System.Collections; using System.Collections.Generic; -using System.Runtime.InteropServices; using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; +using UnityEngine.Networking; using SFB; [RequireComponent(typeof(Button))] @@ -52,10 +51,19 @@ private void OnClick() { private IEnumerator OutputRoutine(string[] urlArr) { var outputText = ""; - for (int i = 0; i < urlArr.Length; i++) { - var loader = new WWW(urlArr[i]); - yield return loader; - outputText += loader.text; + for (int i = 0; i < urlArr.Length; i++) + { + UnityWebRequest www = UnityWebRequest.Get(urlArr[i]); + yield return www.SendWebRequest(); + + if (www.result != UnityWebRequest.Result.Success) + { + Debug.LogError(www.error); + } + else + { + outputText += www.downloadHandler.text; + } } output.text = outputText; }