Ethereum Unity3D Boilerplate Questions

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

@SamR,

Thank you for the comments. I do plan on creating some more complex examples to showcase more of the Moralis SDK.

Regards,

David

1 Like

Hello Moralis Community!

Having fun with Unity+Crypto including Moralis and working my way through creating robust custom demos. More details to come! https://github.com/SamuelAsherRivello/Intro_To_Unity_Crypto/

2 Likes

Cool - are these live already?

Hi David,
Was just looking to try out the latest changes with the addition of support for webgl but it seems like there are some compile issuesā€¦ maybe the api folder is missing in ā€œAssets/MoralisWeb3ApiSdk/Moralis/Moralis.WebGL/Moralis.Web3Apiā€? (there is a meta file but no folder)

1 Like

Hi. we want to make a game with Unity and integrate with blockchain.

1: in your Youtube channel i just saw 1 video about Unity, did you have a full SDK or API for unity as well as React or other languages?
2: You have a server. What happens when the server shuts down ? so in this case our Dapp is not Dapp! and doesnā€™t work. Right?
3: if you support Unity, what Version is good for working with metamask or other wallets in a game? For example Mobile version or OpenGL version?

1 Like

Hi, justed wanted to ask if Cloud Code support is available via this package.
If not, Iā€™d like to know how to deploy some code to Moralis Cloud since our requirement hinges on it.

1 Like

Sorry you encountered an issue with the new package. Were you using an existing project or a new project? Please let me know. To double check, I created a new project and imported the package. It ran without compile errors.

Some things to check:

  1. Look in the path indicated Assets/MoralisWeb3ApiSdk/Moralis - is the Moralis.Web3Api folder actually missing?
    a) If yes, try re-importing the package (if this is a new project delete the MoralisWeb3ApiSdk folder.first.)
    b) If no, delete the meta file and allow Unity to recreate it.

Please let me know if this helps or not.

Regards,

David

1: in your Youtube channel i just saw 1 video about Unity, did you have a full SDK or API for unity as well as React or other languages?

Yes, the full SDK (other than Plugins - this is coming soon) is available for Unity3D. Moralis also offers the full SDK in JavaScript, React, and React Native.

2: You have a server. What happens when the server shuts down ? so in this case our Dapp is not Dapp! and doesnā€™t work. Right?

Moralis has layers of servers distributed across the globe so a complete outage is very unlikely.

3: if you support Unity, what Version is good for working with metamask or other wallets in a game? For example Mobile version or OpenGL version?

Any version of Unity3D, 2020.3 and newer. The platforms should all work with the same wallets. The SDK utilizes Wallet Connect so any wallet compatible with Wallet connect can be used. That being said we have noticed that Metamask sometimes has issues communicating with Wallet Connect (we do know that Wallet Connect and Metamask are actively working on this). Due to this we usually test with other wallets.

Hope this helps. Please let me know if you have any other questions.

Regards,

David

So far I understand from the code base that I can execute Cloud functions from Unity but I see no means to deploy cloud functions. Maybe I have to use JS for that.

1 Like

Thanks for asking, yes, Moralis Cloud Functions are supported by the oralis / Unity SDK. The newest version of the boilerplate demonstrates this in the TokenListController.cs file.

Here is the code snippet that shows how to call a cloud funtion:

// Field(s) for the cloud function.
IDictionary<string, object> pars = new Dictionary<string, object>();

pars.Add("url", token.Thumbnail);

ResourceResponse resourceResponse = await MoralisInterface.GetClient().Cloud.RunAsync<ResourceResponse>("loadResource", pars);

The code for the Cloud Function being called, ā€œloadResourceā€, is in the Boilerplate README.

Please let me know if you have any other questions.

Regards,

David

1 Like

You can add Cloud functions directly in your Moralis Server or by using the CLI (correct this is Javascript)

Regards,

David

1 Like

Please check out the Cloud Functions doc page for more information about using CLI to deploy Cloud Functions.