Importing Nethereum in Unity

Connect Unity games to the Ethereum blockchain

Leon Do
Coinmonks
Published in
3 min readOct 5, 2020

--

Overview

This tutorial will import Nethereum to Unity and fetch the current block number.

  • Download/Create Unity project
  • Download Nethereum .dll
  • Import Nethereum in Unity
  • Fetch current block height

Unity

Install Unity: https://unity.com/

Create a new Unity project.

Using Nethereum

There are a few ways to use the Nethereum library. This example will download the .dll from Github.

Visit: https://github.com/Nethereum/Nethereum/releases/tag/3.5.0

Download net461dllsAOT.zip

If you encounter errors later on, remove

System.Net.Http.dll andUnityEngine.dll

Drag the folder into your Unity project under Assets. Feel free to rename the folder. The Nethereum library is now available.

Fetch Block Number

For demonstration purposes, create a script in the Main Camera

Name it BlockNumber

Open the script

Update the script

Click Play and check the Console!

Conclusion

This article lays the foundation for more complex interactions such as sending and interacting with smart contracts. For another working example, check

Also, Read

--

--