Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unity SDK docs, phase 1 #199

Merged
merged 181 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from 171 commits
Commits
Show all changes
181 commits
Select commit Hold shift + click to select a range
5b34655
First draft of Unity quickstart
timothymcmackin Nov 21, 2023
7364bdf
Working with listeners
timothymcmackin Nov 22, 2023
6a1f0d6
Next steps
timothymcmackin Nov 22, 2023
7823051
It uses Beacon
timothymcmackin Nov 22, 2023
51fd79d
Handle wallet setup in another topic
timothymcmackin Nov 27, 2023
aef72e3
Trim setup steps
timothymcmackin Nov 27, 2023
31bbe88
Wallet connection in simpler terms
timothymcmackin Nov 27, 2023
fed3edc
tweaks
timothymcmackin Nov 27, 2023
98f80c1
indenting
timothymcmackin Nov 27, 2023
5fa67d5
Getting token balances
timothymcmackin Nov 27, 2023
e7096d7
typo
timothymcmackin Nov 27, 2023
b68edf8
unnecessary comma
timothymcmackin Nov 27, 2023
14a2595
events
timothymcmackin Nov 27, 2023
c147b4a
Managing tokens
timothymcmackin Nov 27, 2023
1afac7d
Getting token info
timothymcmackin Nov 27, 2023
3e058fa
Smarter filtering
timothymcmackin Nov 27, 2023
88bea94
Looking up tokens on a block explorer
timothymcmackin Nov 27, 2023
466784f
Put the beacon info in the right place
timothymcmackin Nov 27, 2023
7faa936
account that originates is the admin
timothymcmackin Nov 28, 2023
79c07e9
These are capitalized
timothymcmackin Nov 28, 2023
2c489dc
the destination account
timothymcmackin Nov 28, 2023
91beb07
Distinguish convenience method from entrypoint
timothymcmackin Nov 28, 2023
87dec83
enable csharp syntax highlighting
timothymcmackin Nov 28, 2023
13761e8
Consistency
timothymcmackin Nov 28, 2023
e1daada
clarifications
timothymcmackin Nov 28, 2023
cf23c3a
Basic signing
timothymcmackin Nov 28, 2023
7aef235
Correct way to install per Berk
timothymcmackin Nov 29, 2023
e53b37e
typo
timothymcmackin Nov 29, 2023
500acc6
Clarify signing, but still not quite sure of it
timothymcmackin Nov 29, 2023
76219f2
Link to instructions for setting up a wallet
timothymcmackin Nov 29, 2023
627280f
Clarify VerifySignedPayload
timothymcmackin Nov 29, 2023
c96bc69
First draft of Unity quickstart
timothymcmackin Nov 21, 2023
63cddf3
Re-enable Unity overview page
timothymcmackin Nov 22, 2023
169b1f8
Newbie-oriented explanation of what you can do with Tezos
timothymcmackin Nov 22, 2023
c4677d1
Remove outdated installation info
timothymcmackin Nov 22, 2023
9ae4066
Quickstart link, installation instructions
timothymcmackin Nov 22, 2023
a025ba7
walletconnection scene
timothymcmackin Nov 22, 2023
e57fb5e
Getting and funding a wallet
timothymcmackin Nov 22, 2023
097db68
Contract scene
timothymcmackin Nov 22, 2023
82c3857
It does remember
timothymcmackin Nov 22, 2023
be28e25
Random number of tokens
timothymcmackin Nov 22, 2023
e709920
Transfer scene
timothymcmackin Nov 22, 2023
e6b5384
Need the TezosManager prefab
timothymcmackin Nov 22, 2023
c01b7da
Summary of objects to be documented
timothymcmackin Nov 22, 2023
5396821
Delete out of date API section
timothymcmackin Nov 22, 2023
a8ea904
todos
timothymcmackin Nov 22, 2023
e7c49af
Simplify main objects that the SDK provides
timothymcmackin Nov 28, 2023
538f45d
update installation instructions
timothymcmackin Nov 29, 2023
7fb75bd
Link to instructions for setting up a wallet
timothymcmackin Nov 29, 2023
9dee7ed
Updated webgl setup instructions
timothymcmackin Dec 1, 2023
18ea37c
Update walletconnection scene
timothymcmackin Dec 1, 2023
057f659
transfer scene update;
timothymcmackin Dec 1, 2023
47472c1
wip
timothymcmackin Dec 1, 2023
792696e
info about prefabs
timothymcmackin Dec 1, 2023
7ddded2
dappmetadata object
timothymcmackin Dec 1, 2023
4f8677b
API, MessageReceiver, and TokenContract objects
timothymcmackin Dec 1, 2023
e164bbf
link to messagereceiver object
timothymcmackin Dec 1, 2023
5f75bdf
TODO about IPFS and metadata
timothymcmackin Dec 1, 2023
0d22fd9
New automated wallet type selection
timothymcmackin Dec 1, 2023
e111e64
Metadata is predefined due to limitation in Beacon
timothymcmackin Dec 4, 2023
ec80603
typo
timothymcmackin Dec 4, 2023
d9bce3c
How to handle ipfs
timothymcmackin Dec 4, 2023
f659445
New TezosAuthenticator prefab
timothymcmackin Dec 4, 2023
651e7fe
Can also use IPFS directly
timothymcmackin Dec 5, 2023
6318c1a
link to install instructions
timothymcmackin Dec 7, 2023
dec55de
Remove qr code info now that the prefab handles it all for you
timothymcmackin Dec 7, 2023
c451adc
Trim down getting info about wallets
timothymcmackin Dec 7, 2023
be2338b
Got this backwards somehow
timothymcmackin Dec 7, 2023
c9ada7f
Trim these sections to focus on the code
timothymcmackin Dec 7, 2023
7ff913d
Trim signing section
timothymcmackin Dec 7, 2023
fc3a5fc
basic info on kukai, more needed
timothymcmackin Dec 8, 2023
7bb2f6a
Working on connection reference
timothymcmackin Dec 11, 2023
99b7707
This is tzip-10, not 7
timothymcmackin Dec 11, 2023
9985d04
Consistency in headings
timothymcmackin Dec 11, 2023
fe0b774
New IPFS upload scene
timothymcmackin Dec 11, 2023
10f2aa2
Move scenes to a separate page
timothymcmackin Dec 11, 2023
78ec000
IPFS upload scene
timothymcmackin Dec 11, 2023
e3c28fd
WIP docs for API object
timothymcmackin Dec 5, 2023
4828294
Docs for dappmetadata object
timothymcmackin Dec 5, 2023
c66571a
WIP docs for messagereceiver object
timothymcmackin Dec 5, 2023
b922ea5
WIP docs for TokenContract object
timothymcmackin Dec 5, 2023
f95c900
They are read-only
timothymcmackin Dec 5, 2023
867338c
Not all of these fields are implemented
timothymcmackin Dec 6, 2023
f98e0b0
Correction
timothymcmackin Dec 6, 2023
d0610dd
Working now
timothymcmackin Dec 6, 2023
412a746
oops
timothymcmackin Dec 6, 2023
0468c67
Move Deploy up top
timothymcmackin Dec 6, 2023
855ae19
Clarify which classes these objects come from
timothymcmackin Dec 6, 2023
f64c995
Clarify signing response
timothymcmackin Dec 6, 2023
2f73e28
Handle JSON data
timothymcmackin Dec 6, 2023
7fea95f
Getting more info from the block explorer to populate the token object
timothymcmackin Dec 6, 2023
f549315
Tweaks
timothymcmackin Dec 6, 2023
a1bd9bd
Info for container topic
timothymcmackin Dec 6, 2023
9a78cc3
Per Berk, don't use the constructors
timothymcmackin Dec 6, 2023
0468a69
Spacing
timothymcmackin Dec 6, 2023
add5de4
What's a counter?
timothymcmackin Dec 6, 2023
bf31a6e
Put prefabs and objects in different sections
timothymcmackin Dec 6, 2023
4e06abd
GetContractMetadata is working now
timothymcmackin Dec 6, 2023
1775361
Tweaks
timothymcmackin Dec 7, 2023
de6bd98
Reference link
timothymcmackin Dec 11, 2023
e22fe00
Rework scenes to be more of what unity devs need
timothymcmackin Dec 11, 2023
7b7b7e3
Simplify
timothymcmackin Dec 12, 2023
8dd1223
This hash may change
timothymcmackin Dec 12, 2023
b8caea0
Location of the source
timothymcmackin Dec 12, 2023
ba66f29
OriginateContract method
timothymcmackin Dec 12, 2023
ba89255
links
timothymcmackin Dec 12, 2023
b4724fe
Put unity docs in their own section
timothymcmackin Dec 13, 2023
e024584
Separate section for Unity SDK
timothymcmackin Dec 13, 2023
d9adc50
Info on entrypoints in the built-in contract
timothymcmackin Dec 14, 2023
f3b1003
Different contract metadata
timothymcmackin Dec 14, 2023
469f145
set_pause
timothymcmackin Dec 14, 2023
619f34d
Delegate address
timothymcmackin Dec 14, 2023
6b3f79b
Figured out how to call views
timothymcmackin Dec 14, 2023
237ff34
Fix RequestSignPayload
timothymcmackin Dec 15, 2023
4ef6376
This is for calling arbitrary contracts
timothymcmackin Dec 15, 2023
9955ae1
add field names
timothymcmackin Dec 18, 2023
a5beaa2
Each template is contained as a subfolder
timothymcmackin Dec 19, 2023
b3c2e79
double-click `WebGLCopyAndPaste.unitypackage`,
timothymcmackin Dec 19, 2023
6c53011
in their wallet application.
timothymcmackin Dec 19, 2023
40d3ee7
Remove reference to MainThreadExecutor
timothymcmackin Dec 19, 2023
259b53f
sets up and initialises the Tezos SDK
timothymcmackin Dec 19, 2023
3824ae3
This package automatically enables copy and paste
timothymcmackin Dec 19, 2023
b5cef73
The SDK also uses the [Newtonsoft JSON Unity Package]...
timothymcmackin Dec 19, 2023
5203fd2
Remove this note because this is now the up to date info
timothymcmackin Dec 19, 2023
1518936
links to reference pages
timothymcmackin Dec 19, 2023
9ff8590
ensure you have a Tezos-compatible wallet
timothymcmackin Dec 19, 2023
7c0790e
typo
timothymcmackin Dec 19, 2023
e817354
Simplified code in quickstart
timothymcmackin Dec 19, 2023
a57554b
Application.persistentDataPath
timothymcmackin Dec 19, 2023
18a6962
to connect to wallets.
timothymcmackin Dec 19, 2023
2d70504
Add comments to creating a token example in quickstart
timothymcmackin Dec 19, 2023
7209e1f
Add comments to code for fetching token balances
timothymcmackin Dec 19, 2023
8ac7987
IRL typo
timothymcmackin Dec 19, 2023
9a2704a
Clarify signing code in quickstart
timothymcmackin Dec 19, 2023
27612f2
title of page to tutorial scenes
timothymcmackin Dec 19, 2023
5eea00f
The SDK includes tutorial scenes
timothymcmackin Dec 19, 2023
c952c7d
**TezosSDK > Tutorials**
timothymcmackin Dec 19, 2023
9c6e572
The tutorials are in individual folders.
timothymcmackin Dec 19, 2023
663daac
Remove imports from code examples
timothymcmackin Dec 19, 2023
576a622
Code update
timothymcmackin Dec 19, 2023
1da6002
or tzkt.io
timothymcmackin Dec 19, 2023
fd803ef
Lost a closing fence here
timothymcmackin Dec 19, 2023
be4cd31
Example scenes => tutorial scenes
timothymcmackin Dec 19, 2023
da1f078
Remove imports from code examples
timothymcmackin Dec 19, 2023
16b13cc
indent consistency
timothymcmackin Dec 19, 2023
2ec74ed
All installation instructions in one place
timothymcmackin Dec 19, 2023
6abee74
Clarify what the prefabs do
timothymcmackin Dec 19, 2023
6478e6e
No underscores, for consistency
timothymcmackin Dec 19, 2023
800008e
tweaks
timothymcmackin Dec 19, 2023
5fc0819
typo
timothymcmackin Dec 20, 2023
9f668ab
Updated scene info
timothymcmackin Dec 20, 2023
302f610
Update screencaps to not show mobile border
timothymcmackin Dec 20, 2023
9d13b80
reorganize images into a unity folder
timothymcmackin Dec 20, 2023
cef9959
clarify airgap webgl template
timothymcmackin Dec 20, 2023
c690e61
Move prefabs up because they are important
timothymcmackin Dec 20, 2023
727b0d1
update info on prefabs
timothymcmackin Dec 20, 2023
0e8f10b
How to change the RPC node
timothymcmackin Dec 20, 2023
a586810
TezosConfig object
timothymcmackin Dec 20, 2023
3e64460
playerprefs
timothymcmackin Dec 22, 2023
81c8ca4
Correct way to initalize with an existing contract
timothymcmackin Dec 22, 2023
d3d0d01
updates to tutorial scenes
timothymcmackin Dec 22, 2023
fa514a8
Correct paths to scenes and files
timothymcmackin Dec 22, 2023
64b57ff
Remove empty objects section
timothymcmackin Dec 28, 2023
d94606b
GetTokenMetadata now returns TokenMetadata
timothymcmackin Dec 28, 2023
807df9b
SDKInitialized event
timothymcmackin Dec 28, 2023
8f2fd4a
AccountConnected and AccountDisconnected are now WalletConnected
timothymcmackin Dec 28, 2023
ee9f04e
AccountConnected and AccountDisconnected are now WalletConnected
timothymcmackin Dec 28, 2023
27a325d
Wallet.IsConnected property
timothymcmackin Dec 28, 2023
103673a
MessageReceiver is now EventManager
timothymcmackin Dec 28, 2023
8f3748a
timeout property
timothymcmackin Dec 28, 2023
ad33e09
HandshakeData property
timothymcmackin Dec 28, 2023
932d5d7
Runs when a connection to a wallet fails.
timothymcmackin Jan 11, 2024
0f261a1
This is now WalletConnectionFailed
timothymcmackin Jan 11, 2024
08fe6b9
Updated tutorial scene setup
timothymcmackin Jan 11, 2024
38721d5
Installation and setup instructions
timothymcmackin Jan 11, 2024
1e672e5
GetActiveAddress is now GetWalletAddress
timothymcmackin Jan 11, 2024
574c1aa
changes to quickstart tasks
timothymcmackin Jan 11, 2024
2881215
updates to prefabs
timothymcmackin Jan 11, 2024
75f15f8
New SOs im place of the TezosConfig object
timothymcmackin Jan 11, 2024
87046ad
Doesn't remember anymore
timothymcmackin Jan 11, 2024
26e0405
better info on using the SOs
timothymcmackin Jan 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 0 additions & 135 deletions docs/dApps/unity.md

This file was deleted.

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

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
timothymcmackin marked this conversation as resolved.
Show resolved Hide resolved
- 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 these objects:

- [`DAppMetadata`](./unity/reference/DAppMetadata): Read-only metadata about the project, including the Name, Url, Icon, and Description fields that you set on the TezosManager prefab in the Unity Editor.

- [`Wallet`](./unity/reference/Wallet): An object that provides information about the connected wallet and allows you to send transactions from the user's account.

- [`EventManager`](./unity/reference/EventManager): An object that provides events that you can add listeners to.
You can see these events and their return values in the `WalletEventManager.cs` file.

- [`TezosConfig`](./unity/reference/TezosConfig): An object that sets the [RPC](../architecture/rpc) node that the SDK uses to send transactions to Tezos

- [`TokenContract`](./unity/reference/TokenContract): An object that provides an FA2 contract and convenience methods to access it.
You can use this object to deploy the contract and call the contract's entrypoints to create and transfer tokens.

- [`API`](./unity/reference/API): An object that provides methods to access data from Tezos, such as an account's balance in tez or the metadata for a token.

## Dependencies
timothymcmackin marked this conversation as resolved.
Show resolved Hide resolved

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: 20 December 2023
---

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 `Runtime/View/TezosAuthenticator.cs`.

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