Display all NFTs In Unity

okay thankyou so much, I will give that a try tomorrow and let you know how it goes

so the code does compile now as I was trying to use the older version of the SDK, now for the fun part of trying to add a nft display method to my ui panel

out of curiosity, should I be okay to continue build and publish my project on a previous sdk or is the newer version recommened? If so, it would be really helpful if the dev’s could update the Unity boilerplate projects to work with the latest sdk version

It is recommended you use the newer SDK if you are able to migrate existing/older code over, and for new projects.

ah okay thankyou I will use the newer sdk, the video is also very helpfull

how to do for any chain user used while login with metamask

You can use getNFTs.

public async void fetchNFTs()
    {
        NftOwnerCollection polygonNFTs = await Moralis.Web3Api.Account.GetNFTs("0x75e3e9c92162e62000425c98769965a76c2e387a".ToLower(), ChainList.polygon);
        Debug.Log(polygonNFTs.ToJson());
    }

This is an example you can look at to get the current wallet address.

This gets the detail but I am not able to fetch any image from this method…can you please if possible explain in detail…

Hi @Shubham I go over what you’re requesting in this tutorial right here:

I was following the same tutorial but have few differences that make all issue I guess.

  1. I don’t have minted nfts, all the nfts are in my wallet
  2. So there’s no shop inventory, I fetched the nfts with moralis function shown in tutorial, but then not able to display it.

What I did use the same code and fetch the nft detail but my nfts are not showing, please help me in detail if possible.

I want to make user login with metamask, then on some pannel all nfts present in person’s wallet should be displayed.

@dpradell please help

1 Like

I think I have a solution for this however I used code from the “nft-Shop” example project, i need to test it today but I’ll post it all here to help anyone out

so I have now got a working unity project that display all nfts owned by a user for a specific contract.

I simply imported the “player inventory” script from the “nft-shop” project and set everything else up the same way the sample project is, call the load items function, and now I have a viewport that populates itself with all the nfts from my contract,

I suppose its still not quite answering the original question of “displaying all nfts” but its a good step for me,

edit: not currently working in webGL using Firefox, does not load the images

edit 02: working in webGL in Chrome

@tseabrook can you share this project with me…so that I can see the codes and know where I was wrong.

sure thing, I’ll share it later today

You’re the life saver…please do share so that I know my mistakes as well as ask you for any further doubts. Thanks a ton man!!!

Heres a quick guide on what I did, sorry I dont really have time to go more in-depth right now but it shows the main steps;

And heres a download link to the project;

I would assume you will have to update the contract address and abi before you get any results as its contract specific for now and obviously im using one of my own test contracts.

I would be really interested to know if and how you manage to develop this as its still not fullfilling all the functionality I want, namely displaying all nfts owned by an address

1 Like

@tseabrook thanks alot, I will look at it and try what I can do possibly

Still not working and this is why I am asking help, @dpradell please help if possible.
@tseabrook not working when I connect with my wallet.

did you also deploy a smart contract, add an nft and replace the 2 fields in the game manager?

@tseabrook I replaced the fields in Game Manager but have not deployed any smart contract, my whole point is to build a game where player login with their metamask, then all nft present in any chain they logged in with should be displayed on panel. I mean any player from anywhere, so why do I need smart contract or ipfs file…I want to fetch nft present in wallet and then display them on panel. I hope I am clear now.

Yes thats one of the things Im trying to acheive but this is as far as Ive got so far,

The reason it needs a contract for now is because of this function “GetNFTsForContract”, which is from the shop tutorail