/metaseed-unity-toolkit

Helps develop games on Unity3d & NEAR blockchain in two click

Primary LanguageC#

Metaseed-unity-toolkit

Helps develop games on Unity3d & NEAR blockchain in two clicks

The plugin is zipped in a “.unitypackage” file in folder “releases/”, and if you need the sources of the package file, they can be found in “source/”. There are 2 demo scenes - one with code, and the second one with components.

Change your project's .NET version to 4.x if you have any errors after importing the plugin (Edit -> Project Settings -> Player -> Api Compatibility Level)

If you find any bugs or need some help feel free to contact us

Also, subscribe to receive our newest announcements and updates

Tutorials

Tutorial Part 1 (Demo scenes overview) [RU]

Tutorial Part 2 Deploying NFT contract [RU]

Example

We have two types of connections or actors in ower Toolkit. They are “Player” and “Developer”.

As you know, a standard NEAR NFT specification requires initializing the contract by the owner, who will have a monopolistic ability to mint tokens. The cost of every token mintage is around 0.1 NEAR due to the storage cost.

In our Toolkit, you can set up the process in the following way.

For example, you want to give your player an NFT after successfully ending each level. To make it possible, you need to have an NFT contract with your Developer account being an owner of this contract so that an unlimited amount of NFTs could be mint.

After that, a player has to log in to his account on NEAR, the account where NFTs will be transferred.

Then at the end of each level, you could transfer 0.1 Near (the cost of creating your NFT) from the player's account to the Developer account. And mint an NFT with transferring it to the player using your Developer account.

If you want to bear the cost of NFT creation you could just skip the steps and even don’t force your user to log in.

The developer account is connected in the setting and used throughout the entire game. The credentials are saved safely inside the build.

Components overview

Note that all toolkits components can be called via Unity scripting like regular components.

Firstly you need to connect your NEAR wallet When the .unitypackage file is installed in your project, “Near” tab will appear at the top menu. Click on “Developer Account” and then on “Connect Wallet”

Alt text

Alt text

After login, you will receive a message - “Successfully, now please return to the editor you are connected!”

Open Unity to see that your account is connected.

Now, after connecting, you can create your first NFT via a Simple NFT publisher. Fill in the fields: Title, Description, TokenId, Link to the media. The receiver id is a NEAR wallet address.

Alt text

Then, in Contract Caller, you can do any logic for interaction between the game and NFT contract so that your game rewards players with NFT’s for certain in-game actions, for example killing the boss.

Alt text

It could be both minting a new NFT or sending a pre-minted NFT to a player. You also could send NEAR from the player account. In order to send the NEAR you just need to specify the receiver’s address and an amount to send.

Alt text