Elden Ring Project

Hello Moralis Team:

First off just want to thank David and the rest of the crew for these amazing, simple to follow YouTube tutorials. This is truly break-through technology on the crypto/gaming scene. Hats off to you guys !!

So I have an issue with the Elden Ring project, although I already connected my Dapp URL/ID to Unity and followed all the instructions as David P. describes on his tutorial I cant get the “connect” button to show up on test mode or windows build. I know Moralis and Unity is fairly new so trying to find a solution on my own for this issue has been hard to say the least. Any input will be much appreciated, thank you in advance.

1 Like

Which version of Unity are you using? It should be 2021.3.2. Make sure your Moralis server is awake. Do you see the main character/scene in the game preview?

Hello glad:

Thank you for the reply. I ended up repeating the project again (this time using Unity 2021.3.2) and this time the “connect”, QR code worked fine, it connects to the mumbai network. But now I’m stuck on the final part of the project.

When you walk up to the mint items after defeating the final boss and press “P” nothing happens and I get this error:

" Call to getItem failed due to: Object reference not set to an instance of an object
UnityEngine.Debug:Log (object)
MoralisUnity.Moralis/d__46:MoveNext () (at Packages/io.moralis.web3-unity-sdk/Runtime/Core/Moralis.cs:696)
MoralisUnity.Moralis:ExecuteContractFunction (string,string,string,object[],Nethereum.Hex.HexTypes.HexBigInteger,Nethereum.Hex.HexTypes.HexBigInteger,Nethereum.Hex.HexTypes.HexBigInteger)
Web3_Elden_Ring.PickingUpItem/d__7:MoveNext () (at Assets/_Project/Scripts/GameStateMachine/States/PickingUpItem.cs:78)
Web3_Elden_Ring.PickingUpItem:GetItem (string)
Web3_Elden_Ring.PickingUpItem/d__6:MoveNext () (at Assets/_Project/Scripts/GameStateMachine/States/PickingUpItem.cs:53)
System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start<Web3_Elden_Ring.PickingUpItem/d__6> (Web3_Elden_Ring.PickingUpItem/d__6&)
Web3_Elden_Ring.PickingUpItem:PickUp (string)
Web3_Elden_Ring.PickingUpItem:OnEnable () (at Assets/_Project/Scripts/GameStateMachine/States/PickingUpItem.cs:35)
Pixelplacement.StateMachine:Enter (UnityEngine.GameObject) (at Assets/ThirdParty/Pixelplacement/Surge/StateMachine/StateMachine.cs:284)
Pixelplacement.StateMachine:ChangeState (UnityEngine.GameObject) (at Assets/ThirdParty/Pixelplacement/Surge/StateMachine/StateMachine.cs:223)
Pixelplacement.StateMachine:ChangeState (string) (at Assets/ThirdParty/Pixelplacement/Surge/StateMachine/StateMachine.cs:240)
Pixelplacement.State:ChangeState (string) (at Assets/ThirdParty/Pixelplacement/Surge/StateMachine/State.cs:86)
Web3_Elden_Ring.Victory:OnPickUp (UnityEngine.InputSystem.InputAction/CallbackContext) (at Assets/_Project/Scripts/GameStateMachine/States/Victory.cs:93)
UnityEngine.InputSystem.LowLevel.NativeInputRuntime/<>c__DisplayClass7_0:<set_onUpdate>b__0 (UnityEngineInternal.Input.NativeInputUpdateType,UnityEngineInternal.Input.NativeInputEventBuffer*)
UnityEngineInternal.Input.NativeInputSystem:NotifyUpdate (UnityEngineInternal.Input.NativeInputUpdateType,intptr) "

Can you try disconnecting and connecting again?

Hi @rofflman and thanks for your kind words. Welcome to the community!

This is an issue solved in the new SDK version, I will be updating the project myself this today and let you know.


Ahh Thank you David,

I will be looking for it.

So yeah, I noticed that if you try switching platforms from Windows to WebGL and then back to windows it looses the “connect and QR login” part.

Also, quick question David, on the Space Shooters game, I was able to rebuild the game with a new map and new enemies and final boss, Im also able to change the moralis NFT cup to my own NFT but can you share a copy of that contract, I tried looking for the code but it has never been verified, is it the same as the “Angry Birds” one? if so, can I use that contract code myself on the Space Shooters game.

Finally, thank you once again for everything, I love you tutorials so much now I’m a monthly paid customer (too much hassle trying to wake up those dApps every time haha). I just finished your AR Metaverse tutorial but had to order an “android” phone on ebay because im IOS and no one in my house has an android :frowning:

Man, I would love for you to come out with a fighting demo game (maybe mugen style type) That would be amazing. Either way, whatever you do next will be amazing.


1 Like

Hi @rofflman,

Again, your words are appreciated. For the Space Shooter I used an already deployed contract which it was not verified, true. And yes, If I remember well it’s the same or very similar to the one used in AngryBirds project:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/security/Pausable.sol";

// deployed to Mumbai at 0x698d7D745B7F5d8EF4fdB59CeB660050b3599AC3
contract GameNfts is ERC1155, ERC1155Holder, AccessControl, Pausable {
    bytes32 public constant URI_SETTER_ROLE = keccak256("URI_SETTER_ROLE");
    bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
    //bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");

    mapping(uint256 => string) _tokenUrls;

    constructor() ERC1155("URI NOT SET") {
        _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _grantRole(URI_SETTER_ROLE, msg.sender);
        _grantRole(PAUSER_ROLE, msg.sender);
        //_grantRole(MINTER_ROLE, msg.sender);

    function setURI(string memory newuri) public onlyRole(URI_SETTER_ROLE) {

    function pause() public onlyRole(PAUSER_ROLE) {

    function unpause() public onlyRole(PAUSER_ROLE) {

    function mint(address account, uint256 id, uint256 amount, string memory url, bytes memory data)
        public //override
        _mint(account, id, amount, data);

        _tokenUrls[id] = url;

    function mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, string[] memory urls, bytes memory data)
        public //override
        require(ids.length == urls.length, "Each id requires a unique url.");

        _mintBatch(to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; i++) {
            _tokenUrls[ids[i]] = urls[i];

    function _beforeTokenTransfer(address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data)
        super._beforeTokenTransfer(operator, from, to, ids, amounts, data);

    // The following functions are overrides required by Solidity.

    function supportsInterface(bytes4 interfaceId)
        override(ERC1155, ERC1155Receiver, AccessControl)
        returns (bool)
        return super.supportsInterface(interfaceId);

     * @dev See {IERC1155MetadataURI-uri}.
     * This implementation returns the same URI for *all* token types. It relies
     * on the token type ID substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     * Clients calling this function must replace the `\{id\}` substring with the
     * actual token type ID.
    function uri(uint256 id) public view virtual override returns (string memory) {
        return _tokenUrls[id];

As you can see I commented “MINTER ROLE” parts as this is a tutorial and there’s no need for setting up AccessControl for users but remember you would need to do that if you’re planning to go in to production.


First of all, thanks a lot to the moralis team for the awesome tutorial. A small doubt. Would like to clarify with you. Am getting invalid JSON-RPC error while tried to change my own nft instead of moralis cup nft. And also getting function not found:claimReward while deployed the above smart contract after changing function name mint to claimReward. Could you please let me know the solutions for these.

Am getting invalid JSON-RPC error while tried to change my own nft instead of moralis cup nft.

How did you change this NFT?

And also getting function not found:claimReward while deployed the above smart contract after changing function name mint to claimReward.

If you change the original smart contract, you’ll need to change the Unity code to match the new contract function name.

How did you change this NFT?

I tried changing by giving contract address and token id of my nft created in opensea. Is there any other way?

If you change the original smart contract, you’ll need to change the Unity code to match the new contract function name.

Only to match the unity code, I changed the function name.

More info:

Have you found the solution. I’m also stuck with the same problem. When tried to replace my own nft minted on opensea by changing the contract address and token id in ClaimNftcontroller editor, got invalid json rpc error failed eth transaction. Also when deployed ERC1155 smart contract after changing mint function to claimreward, and changed the details in constants.cs file, got claimreward function not found error.

Can you give the link for this NFT on OpenSea?

Only to match the unity code, I changed the function name.

Make sure you’re using the changed ABI as well for the new contract. If you keep having trouble with this, just use the original contract and project code until you get it all working with your new NFT.