Workflow & References

Workflow / Script References

Puppy Gaming/Scripts/Plugins/solana.jslib

This file contains all the code needed for the WebGL player and also the code needed to log into the wallet from the selected chain, then loading all the wallets NFTs and finally grabbing the metadata from them and sending them to the CryptoReceiver GameObject in your scene. The functions in this file are commented for easier understanding.

Puppy Gaming/Prefabs/CryptoReceiver.cs

The CryptoReceiver prefab should be placed in your first Scene when the player would be logging into their wallet, it will persist across scenes so no need to add it anywhere else.

The CryptoReceiver script receives the data from the Login request process and puts the metadata from each NFT into a CryptoNFT ScriptableObject and then instantiates that object in the MyNFTs List from the ReceiveNFT() function. This list can be accessed by any other script with CryptoReceiver.CR.myNFTs

The current accessible data from a CryptoNFT object is;

.nftName - The NFTs name,

.spritelink - The image URL for the NFT,

.description - The collections description.

(more metadata to be added)

It also creates a list of NFT Public Addresses that can be found in CryptoReceiver.CR.myTokens which helps if you don’t need to grab metadata and just want to use the Addresses for comparisons.

You can get the user’s Wallet Address from CryptoReceiver.CR.walletAddress and a shortened version of the address for in-game display like ‘AaAa….BbBb’ from CryptoReceiver.CR.shortAddress

You can check whether the address has been collected with CryptoReceiver.CR.isConnected bool

Last updated