diff --git a/Assets/Scripts/PropositionFrame.cs b/Assets/Scripts/PropositionFrame.cs index c5313b9..ec6c7a4 100644 --- a/Assets/Scripts/PropositionFrame.cs +++ b/Assets/Scripts/PropositionFrame.cs @@ -1,9 +1,9 @@ +using System; using System.Collections; using System.Collections.Generic; using Firebase.Extensions; using Firebase.Storage; using TMPro; -using UnityEditor.SceneManagement; using UnityEngine; using UnityEngine.Networking; using UnityEngine.UI; @@ -51,7 +51,7 @@ private void DisplayPicture(string _url) }); } - private IEnumerator DownloadImage(string _url, System.Action callback_OnTextureDownloaded) + private IEnumerator DownloadImage(string _url, Action callback_OnTextureDownloaded) { UnityWebRequest request = UnityWebRequestTexture.GetTexture(_url); yield return request.SendWebRequest(); diff --git a/Assets/Scripts/StorageManager.cs b/Assets/Scripts/StorageManager.cs index 1c2632d..a96e809 100644 --- a/Assets/Scripts/StorageManager.cs +++ b/Assets/Scripts/StorageManager.cs @@ -1,8 +1,10 @@ using Firebase.Database; using Firebase.Storage; using System; +using System.Collections; using System.Threading.Tasks; using UnityEngine; +using UnityEngine.Networking; public class StorageManager : MonoBehaviour { @@ -62,6 +64,20 @@ public void UploadPhoto(string roomCode, string playerId, int question, int prop .SetValueAsync(imageRef.Path); } }); + } + public IEnumerator DownloadImage(string _url, Action callback_OnTextureDownloaded) + { + UnityWebRequest request = UnityWebRequestTexture.GetTexture(_url); + yield return request.SendWebRequest(); + + if (request.result != UnityWebRequest.Result.Success) + { + Debug.LogError(request.error); + } + else + { + callback_OnTextureDownloaded?.Invoke(((DownloadHandlerTexture)request.downloadHandler).texture); + } } } diff --git a/ProjectSettings/GvhProjectSettings.xml b/ProjectSettings/GvhProjectSettings.xml index 7347bcf..47fce63 100644 --- a/ProjectSettings/GvhProjectSettings.xml +++ b/ProjectSettings/GvhProjectSettings.xml @@ -1,10 +1,6 @@ - - - - \ No newline at end of file