ExecuteContractFunction error. SetContractResponse assembly:<unknown assembly> type:<unknown type> member:(null)

Hi there.
When using the function “ExecuteContractFunction” in Unity, I get an error:

Call to mint failed due to: SetContractResponse assembly:<unknown assembly> type:<unknown type> member:(null)


What I have:

  1. Contract with this function
function mint(address account, uint256 id, uint256 amount) public onlyOwner 
{
    _mint(account, id, amount, "");
}
Full contract text
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";

contract HexroastNFT is ERC1155, Ownable {
    using SafeMath for uint256;

    uint256 randomSalt;

    event MintToken(address indexed addr, uint256 tokenId, uint256 amount);
    event BurnToken(address indexed addr, uint256 tokenId, uint256 amount);
    event OpenLootBoxBurnToken(address indexed addr, uint256 tokenId, uint256 amount);
    event OpenLootBoxMintToken(address indexed addr, uint256 tokenId, uint256 amount);
    event OpenLootBoxMintBatchToken(address indexed addr, uint256[] tokenIds, uint256[] amounts);

    constructor() ERC1155("https://fdjbqyeqertw.usemoralis.com/metadata/json/{id}.json") {}

    function mint(address account, uint256 id, uint256 amount) public onlyOwner {
        _mint(account, id, amount, "");
        emit MintToken(account, id, amount);
    }

    function burn(address account, uint256 id, uint256 amount) public {
        require(_msgSender() == account);
        _burn(_msgSender(), id, amount);
        emit BurnToken(_msgSender(), id, amount);
    }

    function openLootBox(uint256 id) public returns (bool status) {
        require(balanceOf(_msgSender(), id) > 0, "HexroastNFT: balance too low");
        require(id == 101 || id == 102, "HexroastNFT: Unknow LootBox");
        uint256 amount = 1;
        _burn(_msgSender(), id, amount);
        emit OpenLootBoxBurnToken(_msgSender(), id, amount);
        if (id == 101) { // one random item
            uint256 item    = _randomItem().mul(1000);
            uint256 rarity  = _randomRarity();
            uint256 tokenId = item.add(rarity);
            _mint(_msgSender(), tokenId, amount, "");
            emit OpenLootBoxMintToken(_msgSender(), tokenId, amount);
            return true;
        } else if (id == 102) { // each random item
            uint256 item;
            uint256 rarity;
            uint256 tokenId;

            //uint256[] memory tokenIds;
            //uint256[] memory amounts;

            for (uint256 index = 0; index < 3; index++) {
                item    = index.add(1).mul(1000);
                rarity  = _randomRarity();
                tokenId = item.add(rarity);

                //tokenIds[index] = tokenId;
                //amounts[index]  = amount;

                _mint(_msgSender(), tokenId, amount, "");
                emit OpenLootBoxMintToken(_msgSender(), tokenId, amount);
            }
            //_mintBatch(_msgSender(), tokenIds, amounts, "");
            //emit OpenLootBoxMintBatchToken(_msgSender(), tokenIds, amounts);
            return true;
        }
    }

    function _randomItem() internal returns (uint256 item) {
        return _random(3);
    }

    function _randomRarity() internal returns (uint256 rarity) {
        uint256 common      = 5500;
        uint256 uncommon    = 2500;
        uint256 rare        = 1000;
        uint256 epic        = 700;
        uint256 unique      = 250;
        uint256 legendary   = 50;
        uint256 totalChance = common + uncommon + rare + epic + unique + legendary;
        uint256 chance      = _random(totalChance);
        if (chance <= common) {
            return 1;
        } else if (chance <= common + uncommon) {
            return 2;
        } else if (chance <= common + uncommon + rare) {
            return 3;
        } else if (chance <= common + uncommon + rare + epic) {
            return 4;
        } else if (chance <= common + uncommon + rare + epic + unique) {
            return 5;
        } else if (chance <= common + uncommon + rare + epic + unique + legendary) {
            return 6;
        }
        return 0;
    }

    function _random(uint256 number) internal returns (uint256) {
        uint256 random = uint256(keccak256(abi.encodePacked(block.timestamp, _msgSender(), randomSalt))).mod(number).add(1);
        randomSalt++;
        return random;
    }
}

  1. Function in Unity
private async Task<string> MintFromContract(uint id, string address, uint amount)
        {
            object[] parameters = {
                address,
                id,
                amount
            };

            // Set gas estimate
            HexBigInteger value = new HexBigInteger("0x0");
            HexBigInteger gas = new HexBigInteger(0);
            HexBigInteger gasPrice = new HexBigInteger("0x0");

            string resp = await Moralis.ExecuteContractFunction(_contractAddress, _contractABI, "mint", parameters, value, gas, gasPrice);

            return resp;
        }
  1. The contract address and ABI are correct and checked several times. The contract is deployed via remix.ethereum.org on my wallet on bcs_testnet chain.

An example was this video:

The Remix functions work correctly and mint objects, as well as burn them when opened with the minting of new ones.

Functions in Unity

Moralis.Web3Api.Account.GetNFTsForContract

and

Moralis.Web3Api.Account.GetNFTs

confirm that everything is working out correctly and NFT items are present in the wallet.


What could be wrong that is why the minding of items in Unity does not happen?

Are you using the latest SDK / game kit version? See if you can call another function on that contract.

Use Web3 Game Kit Package v1.2.4
Other contract functions are also not called. The same mistake.

I got the same error in another simple contract.

Call to store failed due to: SetContractResponse assembly:<unknown assembly> type:<unknown type> member:(null)

This is ABI:

[{“inputs”:[],“name”:“retrieve”,“outputs”:[{“internalType”:“uint256”,“name”:"",“type”:“uint256”}],“stateMutability”:“view”,“type”:“function”},{“inputs”:[{“internalType”:“uint256”,“name”:“num”,“type”:“uint256”}],“name”:“store”,“outputs”:[],“stateMutability”:“nonpayable”,“type”:“function”}]

This is Remix contract: