Created
February 8, 2022 10:29
-
-
Save JohannesLoot/754bdbe6107d9a78f1842c125aee57ab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void GetCorrectWordsFromCloud(int fileIndex) | |
{ | |
string[] list = new string[] { "89852" }; | |
LootLockerSDKManager.GetAssetsById(list, (response) => | |
{ | |
if (response.success) | |
{ | |
Debug.Log("Successfully retrieved " + response.assets.Length + " assets"); | |
Debug.Log("First Asset ID: " + response.assets[0].id); | |
// Does the file exist? | |
if (response.assets[0].files[fileIndex] != null) | |
{ | |
// Get the file requested by the index | |
StartCoroutine(GetFileRoutine(response.assets[0].files[fileIndex].url)); | |
} | |
} | |
else | |
{ | |
Debug.Log("Error retrieving assets"); | |
} | |
}); | |
} | |
public IEnumerator GetFileRoutine(string url) | |
{ | |
using (UnityWebRequest www = UnityWebRequest.Get(url)) | |
{ | |
yield return www.SendWebRequest(); | |
if (www.result == UnityWebRequest.Result.ConnectionError || www.result == UnityWebRequest.Result.ProtocolError) | |
{ | |
Debug.Log(www.error); | |
} | |
else | |
{ | |
wordlist = www.downloadHandler.text; | |
hasWordList = true; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment