Unity and Ethereum: Why and How | raywenderlich.com

Introduction You know about Bitcoin, but do you know about its relative, Ethereum, and the potential it offers for gaming? In this tutorial, you’ll learn why Ethereum is interesting for game developers and how it works from a game developer’s perspective. By the end of this tutorial, you’ll know: Why the Ethereum network can disrupt […]

This is a companion discussion topic for the original entry at https://www.raywenderlich.com/5509-unity-and-ethereum-why-and-how

Any suggestions on how to fix this error? Also this is a awesome tutorial completely revolutionary thank you!

Assets/Unity-and-Ethereum-project-final/Assets/RW/Scripts/HighScoreController.cs(182,34): error CS0433: The type ‘BigInteger’ exists in both ‘Nethereum.Hex, Version=, Culture=neutral, PublicKeyToken=null’ and ‘netstandard, Version=, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’

@beringela Can you please help with this when you get a chance? Thank you - much appreciated! :]

Glad you enjoyed the tutorial.

@cryptoboy44 what version of Unity are you using?

Thank You for responding. I am using Unity 2019.1.0a13.

2019.1 deprecated the .net 3.5 runtime. To get project to build you need to use this older runtime. Try this:

In player settings → other settings → configuration → scripting runtime version → chose “3.5 deprecated”.

You’ll be prompted to save and restart Unity, then error should go away.

Hi Kevin. Very interesting tutorial. Right now, account + private key are hardcoded in Unity… a few questions:

How will users input their account address in the game? How will they input the PK? Specially… Will they trust your game to enter their PK? I mean, a mean developer could steal players PKs…

Option B) Maybe we could generate an account “on the fly” for each player, with a new PK. This can be “transparent” to the player. He only knows he has 0 ether. Then the game shows his brand new account address (he can copy it) and asks player to “insert credits”, ie: “send some ether to your account to play”. At any times the player can insert ether or send out balance to his external wallet.
How could you do this? I mean, creating a new account + PK?

Which option seems better for you?

(I guess option A is similar to DEXs and option B is similar to Centralized Exchanges that hold your private keys for you)

Hi dk007, yes good points. It would be a bad idea to trust your PK to a game, I agree with you totally. In practice, what would be needed would be integration with some sort of separate wallet app that could manage the signing of transactions,

On desktop, I believe this could be done with metamask, and a mobile version of metamask is in the works. There is also a project called uPort which is all about managing identity and keys.

Your option B is a good idea. You definitely don’t want players to have to faff around downloading and installing a wallet app, registering with an exchange, transfering USD for ETH before they play your game. The idea of silently pre-creating accounts is what I think is done by chainmonsters.io and I think also I read the loom framework or some loom-based games do similar. Once the player has decided they like the game, then they can be slowly introduced to accounts and ether.

Yes you can get Nethereum to create private keys for you, see here Accounts in Nethereum - Nethereum Documentation section “how to create a new account”.

I’m not allowed to post >2 links per reply so:
uPort = https://www.uport.me
Loom = https://loomx.io

on EOS blockchain it would be much faster and cheaper.

Yes, there is a lot of rivalry between the various blockchain techs. What makes it hard to choose a “smart contract plaform” is that all the tech is improving all the time.

At the time of writing the above article Ethereum had (by far) the largest base of developers using it, a great set of tools (GitHub - ConsenSys/ethereum-developer-tools-list: A guide to available tools and platforms for developing on Ethereum.), and a very robust client (Nethereum) with Unity samples in C#.

So Ethereum seemed like a logical choice for describing the benefits that blockchain could bring to Ray Wenderlich’s Unity readers.

EOS seems a great platform too, although I’ve not used it (and it is not without it’s critics). It would be interesting to see the same sort of solution developed with EOS to compare the dev experience, user experience etc.

I was so glad when i found this tutorial, but i am getting the same errors as another commenter here. New versions of unity does not seem to have the ability to downgrade .net or atleast i dont understand how.

Would it be to much to as to request an updated tutorial how to integrate nethereum into unity? I know this guide has gotten a lot of traffic, and probably still does! Thanks a alot.

@cryptojanne Thank you for your suggestion - much appreciated! I will forward this to the tutorial team.

This tutorial is more than six months old so questions are no longer supported at the moment for it. Thank you!