Skip to content

Commit

Permalink
Unity SDK docs, phase 1 (#199)
Browse files Browse the repository at this point in the history
* First draft of Unity quickstart

* Working with listeners

* Next steps

* It uses Beacon

* Handle wallet setup in another topic

* Trim setup steps

* Wallet connection in simpler  terms

* tweaks

* indenting

* Getting token balances

* typo

* unnecessary comma

* events

* Managing tokens

* Getting token info

* Smarter filtering

* Looking up tokens on a block explorer

* Put the beacon info in the right place

* account that originates is the admin

* These are capitalized

* the destination account

* Distinguish convenience method from entrypoint

* enable csharp syntax highlighting

* Consistency

* clarifications

* Basic signing

* Correct way to install per Berk

* typo

* Clarify signing, but still not quite sure of it

* Link to instructions for setting up a wallet

* Clarify VerifySignedPayload

* First draft of Unity quickstart

* Re-enable Unity overview page

* Newbie-oriented explanation of what you can do with Tezos

* Remove outdated installation info

* Quickstart link, installation instructions

* walletconnection scene

* Getting and funding a wallet

* Contract scene

* It does remember

* Random number of tokens

* Transfer scene

* Need the TezosManager prefab

* Summary of objects to be documented

* Delete out of date API section

* todos

* Simplify main objects that the SDK provides

* update installation instructions

* Link to instructions for setting up a wallet

* Updated webgl setup instructions

* Update walletconnection scene

* transfer scene update;

* wip

* info about prefabs

* dappmetadata object

* API, MessageReceiver, and TokenContract objects

* link to messagereceiver object

* TODO about IPFS and metadata

* New automated wallet type selection

* Metadata is predefined due to limitation in Beacon

* typo

* How to handle ipfs

* New TezosAuthenticator prefab

* Can also use IPFS directly

* link to install instructions

* Remove qr code info now that the prefab handles it all for you

* Trim down getting info about wallets

* Got this backwards somehow

* Trim these sections to focus on the code

* Trim signing section

* basic info on kukai, more needed

* Working on connection reference

* This is tzip-10, not 7

* Consistency in headings

* New IPFS upload scene

* Move scenes to a separate page

* IPFS upload scene

* WIP docs for API object

* Docs for dappmetadata object

* WIP docs for messagereceiver object

* WIP docs for TokenContract object

* They are read-only

* Not all of these fields are implemented

* Correction

* Working now

* oops

* Move Deploy up top

* Clarify which classes these objects come from

* Clarify signing response

* Handle JSON data

* Getting more info from the block explorer to populate the token object

* Tweaks

* Info for container topic

* Per Berk, don't use the constructors

* Spacing

* What's a counter?

* Put prefabs and objects in different sections

* GetContractMetadata is working now

* Tweaks

* Reference link

* Rework scenes to be more of what unity devs need

* Simplify

* This hash may change

* Location of the source

* OriginateContract method

* links

* Put unity docs in their own section

* Separate section for Unity SDK

* Info on entrypoints in the built-in contract

* Different contract metadata

* set_pause

* Delegate address

* Figured out how to call views

* Fix RequestSignPayload

* This is for calling arbitrary contracts

* add field names

* Each template is contained as a subfolder

Co-authored-by: Can Berk T. <[email protected]>

* double-click `WebGLCopyAndPaste.unitypackage`,

Co-authored-by: Can Berk T. <[email protected]>

* in their wallet application.

Co-authored-by: Can Berk T. <[email protected]>

* Remove reference to MainThreadExecutor

* sets up and initialises the Tezos SDK

Co-authored-by: Can Berk T. <[email protected]>

* This package automatically enables copy and paste

* The SDK also uses the [Newtonsoft JSON Unity Package]...

* Remove this note because this is now the up to date info

* links to reference pages

* ensure you have a Tezos-compatible wallet

Co-authored-by: Can Berk T. <[email protected]>

* typo

* Simplified code in quickstart

Co-authored-by: Can Berk T. <[email protected]>

* Application.persistentDataPath

Co-authored-by: Can Berk T. <[email protected]>

* to connect to wallets.

Co-authored-by: Can Berk T. <[email protected]>

* Add comments to creating a token example in quickstart

Co-authored-by: Can Berk T. <[email protected]>

* Add comments to code for fetching token balances

Co-authored-by: Can Berk T. <[email protected]>

* IRL typo

Co-authored-by: Can Berk T. <[email protected]>

* Clarify signing code in quickstart

Co-authored-by: Can Berk T. <[email protected]>

* title of page to tutorial scenes

* The SDK includes tutorial scenes

Co-authored-by: Can Berk T. <[email protected]>

* **TezosSDK > Tutorials**

Co-authored-by: Can Berk T. <[email protected]>

* The tutorials are in individual folders.

Co-authored-by: Can Berk T. <[email protected]>

* Remove imports from code examples

Co-authored-by: Can Berk T. <[email protected]>

* Code update

Co-authored-by: Can Berk T. <[email protected]>

* or tzkt.io

Co-authored-by: Can Berk T. <[email protected]>

* Lost a closing fence here

* Example scenes => tutorial scenes

* Remove imports from code examples

* indent consistency

* All installation instructions in one place

* Clarify what the prefabs do

* No underscores, for consistency

* tweaks

* typo

* Updated scene info

* Update screencaps to not show mobile border

* reorganize images into a unity folder

* clarify airgap webgl template

* Move prefabs up because they are important

* update info on prefabs

* How to change the RPC node

* TezosConfig object

* playerprefs

* Correct way to initalize with an existing contract

* updates to tutorial scenes

* Correct paths to scenes and files

* Remove empty objects section

* GetTokenMetadata now returns TokenMetadata

* SDKInitialized event

* AccountConnected and AccountDisconnected are now WalletConnected

* AccountConnected and AccountDisconnected are now WalletConnected

* Wallet.IsConnected property

* MessageReceiver is now EventManager

* timeout property

* HandshakeData property

* Runs when a connection to a wallet fails.

Co-authored-by: Can Berk T. <[email protected]>

* This is now WalletConnectionFailed

* Updated tutorial scene setup

* Installation and setup instructions

* GetActiveAddress is now GetWalletAddress

* changes to quickstart tasks

* updates to prefabs

* New SOs im place of the TezosConfig object

* Doesn't remember anymore

* better info on using the SOs

---------

Co-authored-by: Can Berk T. <[email protected]>
  • Loading branch information
timothymcmackin and oskar-ziller authored Jan 12, 2024
1 parent d23c40e commit 58bb260
Show file tree
Hide file tree
Showing 30 changed files with 1,788 additions and 136 deletions.
135 changes: 0 additions & 135 deletions docs/dApps/unity.md

This file was deleted.

42 changes: 42 additions & 0 deletions docs/unity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: Tezos SDK for Unity
authors: Tim McMackin
last_update:
date: 11 January 2024
---

The Tezos SDK for Unity provides tools that let you access user wallets and Tezos in games and other Unity projects.
You can use Tezos via the SDK to:

- Use a player's Tezos account as their account for a game and their wallet as their way of logging in to the game
- Accept payments from players in tez
- Use Tezos to create game assets, store player inventories, and transfer assets between players
- Verify that users own specific game assets and allow them to sell or share them to other players
- Use Tezos smart contracts as backend logic for games

## Installation and use

For a walkthrough of installing and using the SDK in an existing Unity project, see [Quickstart](./unity/quickstart).

## Tutorial scenes

The SDK includes tutorial scenes that demonstrate how to use the SDK.
For information about setting up and using the scenes, see [Tutorial scenes](./unity/scenes).

## SDK objects

The SDK provides objects that you can use to interact with user wallets and with Tezos.
See [Unity SDK reference](./unity/reference).

## Dependencies

The Tezos SDK uses modified versions of the following libraries for communication:

- **Airgap Beacon SDK**: Interacts with Tezos wallets through the Beacon standard for iOS, Android, and WebGL platforms.
- **Netezos**: Interacts with Tezos wallets through the Beacon standard for Windows, Linux, and MacOS platforms. Also prepares parameters for smart contract calls and interprets complex data returned by the ReadView method.

The SDK also uses the [Newtonsoft JSON Unity Package](https://docs.unity3d.com/Packages/[email protected]/manual/index.html).

## Supported Platforms

The SDK supports Windows, Linux, MacOS, iOS, Android, and WebGL platforms.
36 changes: 36 additions & 0 deletions docs/unity/prefabs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: Unity SDK prefabs
sidebar_label: Prefabs
authors: Tim McMackin
last_update:
date: 11 January 2024
---

The Tezos SDK for Unity provides these prefabs:

## TezosManager

This prefab sets the metadata for the scene, such as the application name that users see in their wallet applications before connecting to the project.
It also initializes the Tezos SDK for use in the scene and creates an instance of the `TezosSDK.Tezos.Tezos` class, which provides access to the SDK objects such as the [Wallet](./reference/Wallet) and [EventManager](./reference/EventManager) objects.

Its fields control what users see in their wallet applications before connecting to the project, as shown in this picture of the Inspector panel:

<img src="/img/unity/unity-inspector-tezosmanager.png" alt="The Inspector panel, showing information about the project" style={{width: 300}} />

## TezosAuthenticator

This prefab provides code to connect to different kinds of Tezos wallets.

If you copy this prefab into your scene and run the scene, it shows a QR code or connection buttons that Tezos wallet applications can scan to connect with the application.
Whether it shows the QR code or buttons depends on whether the project is running in standalone, mobile, or WebGL mode.
You can access these features through the prefab and change how the project manages its connection to users' wallets.

The prefab's `LoginPanel` object includes objects that connect to wallets in different ways:

- The `QRCode` object shows a QR code that wallet apps can scan to connect
- The `LoginButtonDeepLink` object shows a button that opens a wallet app on a mobile device or a wallet browser extension in a web browser via the Beacon SDK
- The `SocialLoginButton` object shows a button that opens a social wallet, such as Kukai

For details about how the prefab works, see the file `TezosAuthenticator.cs`.

For an example of the prefab in use, see the [WalletConnection tutorial scene](./scenes#walletconnection-scene).
Loading

0 comments on commit 58bb260

Please sign in to comment.