async void Start() { string chain = "ethereum"; string network = "rinkeby"; string contract = "0x3a8A85A6122C92581f590444449Ca9e66D8e8F35"; string tokenId = "5"; // fetch uri from chain string uri = await ERC1155.URI(chain, network, contract, tokenId); print("uri: " + uri); // fetch json from uri UnityWebRequest webRequest = UnityWebRequest.Get(uri); await webRequest.SendWebRequest(); Response data = JsonUtility.FromJson <Response>(System.Text.Encoding.UTF8.GetString(webRequest.downloadHandler.data)); // parse json to get image uri string imageUri = data.image; print("imageUri: " + imageUri); // fetch image and display in game UnityWebRequest textureRequest = UnityWebRequestTexture.GetTexture(imageUri); await textureRequest.SendWebRequest(); this.gameObject.GetComponent <Renderer>().material.mainTexture = ((DownloadHandlerTexture)textureRequest.downloadHandler).texture; }
async void Start() { string chain = "binance"; string network = "mainnet"; string contract = "0x3E31F70912c00AEa971A8b2045bd568D738C31Dc"; string tokenId = "770"; string uri = await ERC1155.URI(chain, network, contract, tokenId); print(uri); }