Last active
September 6, 2022 10:53
-
-
Save jelilat/4dcc2acf744d1e251d22a0f89739d6be 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
using System.Collections; | |
using System.Numerics; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.SceneManagement; | |
public class ERC721BalanceOfExample : MonoBehaviour | |
{ | |
public GameObject insufficient; | |
async void Start() | |
{ | |
string chain = "polygon"; | |
string network = "mainnet"; | |
string contract = "0xB9790B87a55982e2905E56f68B67cF9BAd502A73"; | |
string account = PlayerPrefs.GetString("Account"); | |
int balance = await ERC721.BalanceOf(chain, network, contract, account); | |
if (balance > 0) | |
{ | |
// Load the game scene | |
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1); | |
} else { | |
// Activate the insufficient token object | |
insufficient.SetActive(true); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment