Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed sample's warnings for Unity version 2019.1.0f2. #57

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified Assets/StandaloneFileBrowser/Sample/BasicSample.cs
100755 → 100644
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
#if UNITY_2018_3_OR_NEWER
using UnityEngine.Networking;
#endif
using SFB;

[RequireComponent(typeof(Button))]
Expand Down Expand Up @@ -46,8 +49,14 @@ private void OnClick() {
#endif

private IEnumerator OutputRoutine(string url) {
#if UNITY_2018_3_OR_NEWER
var loader = UnityWebRequestTexture.GetTexture(url);
yield return loader.SendWebRequest();
output.texture = ((DownloadHandlerTexture)loader.downloadHandler).texture;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or more simply:

output.texture = DownloadHandlerTexture.GetContent(loader);

#else
var loader = new WWW(url);
yield return loader;
output.texture = loader.texture;
#endif
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
#if UNITY_2018_3_OR_NEWER
using UnityEngine.Networking;
#endif
using SFB;

[RequireComponent(typeof(Button))]
Expand Down Expand Up @@ -46,8 +49,14 @@ private void OnClick() {
#endif

private IEnumerator OutputRoutine(string url) {
#if UNITY_2018_3_OR_NEWER
var loader = UnityWebRequest.Get(url);
yield return loader.SendWebRequest();
output.text = loader.downloadHandler.text;
#else
var loader = new WWW(url);
yield return loader;
output.text = loader.text;
#endif
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
#if UNITY_2018_3_OR_NEWER
using UnityEngine.Networking;
#endif
using SFB;

[RequireComponent(typeof(Button))]
Expand Down Expand Up @@ -53,9 +56,15 @@ private void OnClick() {
private IEnumerator OutputRoutine(string[] urlArr) {
var outputText = "";
for (int i = 0; i < urlArr.Length; i++) {
#if UNITY_2018_3_OR_NEWER
var loader = UnityWebRequest.Get(urlArr[i]);
yield return loader.SendWebRequest();
outputText += loader.downloadHandler.text;
#else
var loader = new WWW(urlArr[i]);
yield return loader;
outputText += loader.text;
#endif
}
output.text = outputText;
}
Expand Down