Ethereum Unity3D Boilerplate Questions

Hi guys,

This is certainly exciting news and I canā€™t wait to test it out.

I have tried to get the demo working by completing the following:

  1. Download UnitySDK
  2. Change VS preferences within Unity
  3. Import SDK to Unity engine
  4. Load up the Demo scene
  5. Insert my unity URI and APP ID

However, if I press the play button in Unity I get the following error:
ā€œNon-Convex MeshCollider with non-kinematic Rigidbody is no longer supported since Unity 5. If you want to use a non-convex mesh either make the Rigidbody kinematic or remove the Rigidbody component.ā€

Now, I donā€™t think this should actually be a problem with authentication, however, I try to press the authenticate button (or any other button) in the game scene from the unity engine and I get no interaction at all. So I canā€™t proceed with the authentication process.

So my questions are:

  1. Do I have to build and run the demo scene before I try this or should it be working direct from the unity engine.
  2. When I do finally get this to authenticate, is this simply using the QR code from my phone to scan or do I need a particular app installed on my phone (sorry use to it opening up metamask, but as stated above, it has limitations).
1 Like

Hi @icefire900,
I am facing the same issue but I am able to run the demo by unchecking the Mesh Collider at ā€œChest_upā€ file.

Hope this helps!

1 Like

@Alice1989,

Currently the Desktop, iOS and Android builds (XBox if you have a dev license from Microsoft) are working.

I am working on an update to make the SDK compatible with WebGL and hope to have it done in the next couple of weeks. In the meanwhile you can develope your game and run it in the IDE (or as a desktop, iOs and Android) app.

Regards,

David

@icefire900,

I apologize for this it was an oversight on my part. I have posted a fix to GitHub. Additionally the updated package I posted this morning contains this and some other minor fixes.

Additionally the fix that @peh1696 mentioned will fix this particular issue.

Regards,

David

@peh1696,

Thanks for responding, it is appreciated. This issue is now fixed in Github as well.

If you notice anything else please let me know!

Regards,

David

1 Like

Hi, Iā€™ve just imported ethereum-unity-boilerplate, but I am missing reference for HttpUtility.UrlEncode, is there some libraries I have missing?

Regards,
Daniel

1 Like

Daniel,

That is a bit confusing. There is only one reference to HttpUtility.UrlEncode in the project and that is in Moralis.Web3Api.Client.ApiClient. HttpUtility is a class in System.Web so it should always be avaialble.

Can you provide a screen shot of the error and the version of Unity3D you are using, and what platform your project is set to use in Build Settings?

Thank you,

David

I found the problem, unity doesnā€™t automatically include System.Web assembly. So Iā€™ve added csc.rps file to assets with -r:System.Web.dll. And it fixed my problem.

Thanks for your quick response
Daniel

1 Like

Cool, thank you for letting me know you found an answer!

Hey there, I downloaded the project and have all the server deployed in the moralis , yet with using the trust wallet with Wallet Connect , still canā€™t validate the URI . Is there any alternative to it ? Also can is there way to do multiplayer operation in Moralis or do I need to get another multinetworking server for it ? Thanks

1 Like

Hi David, nice work with the unity 3d boilerplate!
I have a few pieces of feedback:

  • The demo is very nice, but it would be good if you could delete the ā€œexampleā€ folder when importing into a project and that folder didnā€™t contain any of the dependencies (right now it contains a bunch of dependencies for wallet connect).
  • It would also be good if there were more examples of using the API to query and fetch Moralis objects
  • In some places you put editor scripts in EditorTools folder instead of special named Editor folder - not sure why?
  • Looking forward to the WebGL implementation and improvements to WalletConnect!

I also have a suggestion of a web3 feature that would be really cool: Unity has addressables - resource bundles that can be created at build time and downloaded like DLC - it would be really cool if we could build them and push them up to IPFS in the editor, and then pull them down from IPFS at runtime. I think that would open up a lot of cool possibilities!

1 Like

Check out this page in the unity docs it might explain what is going on (with .Net Standard 2.0 vs .Net 4.7)

1 Like

The packages folder does contain some W.C. specific components. I can move this out of the example folder. The only other specific W.C. item is the WalletConnect object but this is an empty game object I created and dropped the W.C. script into.

Agreed. I am not sure if I will add these to this boilerplate or create a demo project just for that purpose. I have some rough examples I used for integration testing. May polish those up and post them, but they are not ā€œgameā€ like.

Hmmā€¦

I guess I need to fix that :slight_smile:

Me too - it is a big hill to climb. Initial try looked good, working through the update now.

I think you are refering to the project files but am not sure.

The project files themselves are auto-generated and anytime I manually update them they are re-generated. If you know of a way to have the project file generate with a TargetFrameWorkVersion other than the default please let me know. To date I have not found on online.

I did develop the SDK and API in .Net Standard2.0 and in the User Preferences this is what I set API Compatibility Level to (this is the prescribed method in the article you linked to as well).

Please continue to share any and all hints and tricks - they are helpful, and I am always learning.

Thanks,

David

You can use Moralis to create a multi-player game. Ivan did a demo to show the basics sample code. Note this demo is not Unity but the same concept can be created using the current Moralis / Unity3D SDK.

As to the Wallet issue:

  1. When you run the game do you see a QR Code?
  2. When you scan the QR Code with Trust Wallet (Settings -> WalletConnect) is a message of any type displayed?

Can you use other Wallets - yes, you can use any wallet that is compatible with Wallet Connect (though MetaMask wallet does not always respond to Wallet Connect requests).

Regards,

David

Yeah this was in regards to danda_dandicā€™s question about missing things - (the problem could be that they werenā€™t using .Net Standard 2.0)

1 Like

Hi guys, can you tell me how I can call a smart contract (that modify the contract state) from within Unity using the SDK?

Thanks.

2 Likes

Hi, thanks for asking. This is a known issue.
You can use NEthereum with Wallet Connect but only in desktop apps at there moment.

I am working with the Wallet Connect / Unity developer to create a fix that will enable this feature on all platforms.

Regards,

David

1 Like

You can use NEthereum with Wallet Connect but only in desktop apps at there moment.

Is there a doc for this specifically working with Moralis? It would help a lot.

Hello @dgoodrich & Moralis Community!

Great to connect and to learn more about opportunities within the world of Unity and Crypto. I am brand new to the Moralis community. Iā€™ve completed the 3-minute dApp project and given the https://github.com/ethereum-boilerplate/ethereum-unity-boilerplate a full review including publishing and playing with the demo.

I am an American citizen with over 20 years of game development experience. Iā€™m shifting my own passions and experience toward the crypto side of gaming and found your company.

Unity is a rich toolset that is (deservedly) outside of the main crypto tooling pipelines and that is a missed opportunity as crypto+gaming continues its rapid ascent in popularity. Glad to see Moralis leading the way.

Kudos on the great work!

Iā€™ll certainly have more questions and feedback soon.

Some suggestions for the GIT Readme

  • Add instructions for the gameplay. Itā€™s not clear what is and isnā€™t to be expected when hitting the Unity play button
  • Add some context regarding authorization. The docs make many assumptions in general, and thatā€™s ok since its early days, but auth is low-hanging fruit for answering common questions. Something simple is ok for now (e.g. Go get an app (link), do free signup (link), then point the phone at the screen to login).

Thanks again!

-Sam Rivello
Unity Game Development Instructor

Resume | Teaching Portfolio: SamuelAsherRivello.com/contact/

2 Likes