Skip to content

bravo-ready/aptos-petra-wallet-unity-integration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Aptos Petra Wallet Unity Integration

Glossary

  • Aptos is a Layer 1 blockchain built with a Rust-based programming language called Move
  • Petra wallet is a crypto wallet on Aptos built by Aptos Labs
  • Unity is a cross-platform game engine developed by Unity Technologies

Why?

You want to develop a game with pay-to-spawn functionality or NFT integration on the Aptos blockchain.

How?

Core Components

The implementation consists of two core components

  • Web3js.jslib
    • Communication between JavaScript and browser
    • Communication between JavaScript and C# (see SendMessage functions)
  • MenuUI.cs
    • Communication between C# and JavaScript (see functions with the attribute [DllImport("__Internal")])

Note

If you want to send transactions with your Petra wallet (or realize any other interaction with the blockchain), you need to add the Aptos SDK to your code.

In our case we added the line

<script type="text/javascript" src="https://unpkg.com/[email protected]/dist/index.global.js"></script>

to the index.html of the WebGL template.

Live Demo

https://aptos-petra-wallet-unity-integration-build.vercel.app

Credits