Skip to content

Instantly share code, notes, and snippets.

@jelilat
Last active September 6, 2022 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jelilat/4dcc2acf744d1e251d22a0f89739d6be to your computer and use it in GitHub Desktop.
Save jelilat/4dcc2acf744d1e251d22a0f89739d6be to your computer and use it in GitHub Desktop.
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