|
4 | 4 | [<img alt=".NET Documentation" src="https://img.shields.io/badge/.NET-Documentation-purple?logo=dotnet&style=for-the-badge" height="30">](https://portal.thirdweb.com/dotnet)
|
5 | 5 |
|
6 | 6 | <div style="border-left: 4px solid #f0ad4e; padding: 10px; background-color: #fcf8e3;">
|
7 |
| - <strong>⚠️ Note: Work in Progress</strong> |
| 7 | + <strong>Note: Active Development</strong> |
8 | 8 | <p>This project is currently under active development. Features, APIs, and behavior may change frequently.</p>
|
9 | 9 | </div>
|
10 | 10 |
|
11 | 11 | # Technical Demo
|
12 | 12 |
|
13 |
| -Try out our multichain game that leverages In-App Wallets and Account Abstraction to create seamless experiences, built in 3 weeks - [Web3 Warriors](https://web3warriors.thirdweb.com/). |
| 13 | +Experience our multichain game demo leveraging In-App and Smart Wallets for seamless gameplay, built in just three weeks - [Web3 Warriors](https://web3warriors.thirdweb.com/). |
14 | 14 |
|
15 | 15 | 
|
16 | 16 |
|
17 | 17 | # Supported Platforms & Wallets
|
18 | 18 |
|
19 |
| -**Build games for WebGL, Desktop and Mobile using 1000+ supported chains, with various login options!** |
| 19 | +**Build games for WebGL, Desktop, and Mobile using 1000+ supported chains, with various login options!** |
20 | 20 |
|
21 | 21 | | Wallet Provider | WebGL | Desktop | Mobile |
|
22 | 22 | | --------------------------------------------- | :-------: | :-------: | :-------: |
|
23 |
| -| **In-App Wallet** (Email, Social, Phone) | ✔️ | ✔️ | ✔️ | |
| 23 | +| **In-App Wallet** (Email, Phone, Socials) | ✔️ | ✔️ | ✔️ | |
24 | 24 | | **Private Key Wallet** (Guest Mode) | ✔️ | ✔️ | ✔️ |
|
25 |
| -| **Wallet Connect** | ✔️ | ✔️ | ✔️ | |
26 |
| -| **MetaMask (Browser Extension)** | ✔️ | — | — | |
27 |
| -| **Smart Wallet** (ERC4337) | ✔️ | ✔️ | ✔️ | |
| 25 | +| **Wallet Connect Wallet** (400+ Wallets) | ✔️ | ✔️ | ✔️ | |
| 26 | +| **MetaMask Wallet** (Browser Extension) | ✔️ | — | — | |
| 27 | +| **Smart Wallet** (Account Abstraction) | ✔️ | ✔️ | ✔️ | |
28 | 28 |
|
29 | 29 | <sub>✔️ Supported</sub> <sub>❌ Not Supported</sub> <sub>— Not Applicable</sub>
|
30 | 30 |
|
31 | 31 | # Why Upgrade to v5?
|
32 | 32 |
|
33 |
| -Thirdweb's Unity SDK v5 takes the approach of taking all its core functionality from our robust [.NET SDK](https://portal.thirdweb.com/dotnet). |
| 33 | +Thirdweb's Unity SDK v5 leverages the robust [.NET SDK](https://portal.thirdweb.com/dotnet) for core functionality, providing a unified API and behavior across platforms. |
34 | 34 |
|
35 |
| -It also gets rid of the WebGL Bridge that previously existed, unifying not only APIs, but behaviors and results. |
| 35 | +## Key Improvements: |
| 36 | +- **Unified API:** Say goodbye to the WebGL Bridge. Now, enjoy a consistent experience across WebGL, Desktop, and Mobile platforms. |
| 37 | +- **Enhanced Composability:** Use our SDK anywhere without worrying about its state. APIs are chain agnostic, enabling seamless interaction with multiple chains. |
| 38 | +- **Native Experience:** The .NET core provides a native, predictable experience, making upgrades less daunting. |
| 39 | +- **Simplified `ThirdwebManager`:** |
| 40 | + - `ThirdwebManager.Instance.SDK.GetContract` is now `ThirdwebManager.Instance.GetContract`, returning `ThirdwebContract`. |
| 41 | + - `ThirdwebManager.Instance.SDK.Wallet.Connect` is now `ThirdwebManager.Instance.ConnectWallet`, returning `IThirdwebWallet`. |
| 42 | + - Handles multiple wallet connections and tracks the active wallet. |
| 43 | + - The prefab is now much simpler and straightforward to setup. |
| 44 | +- **Optimized Package:** Cleaner, lighter Unity package with minimal dependencies, enhancing performance. We took control of all the layers and rewrote them, further improving the experience when using thirdweb infra. No AWS SDK. Nethereum is used only for types/encoding. Newtonsoft.Json and EDM4U are included. |
| 45 | +- **Cross-Platform Consistency:** No behavioral differences between platforms. What you see in the editor is what you get in WebGL, Standalone, and Mobile runtime platforms. |
36 | 46 |
|
37 |
| -Using the .NET SDK as a core, we unlock that last bit of flexibility that was much needed in v4, and removes all the clutter. |
38 |
| - |
39 |
| -Composability allows you to simply use our SDK anywhere without worrying about the state it is tied to. |
40 |
| - |
41 |
| -Most APIs are chain agnostic, allowing you to create wallets for different chains, interact with contracts on different chains, without having to switch networks or reinitialize the SDK. |
42 |
| - |
43 |
| -Using .NET cross-platform allows for a much more native and predictable experience, and upgrades become a lot less scary to import! |
44 |
| - |
45 |
| -The `ThirdwebManager` is now simply a wrapper simplifying your interaction with the underlying APIs, it preserves familiar APIs from v4: |
46 |
| -- `ThirdwebManager.Instance.SDK.GetContract` is now `ThirdwebManager.Instance.GetContract` |
47 |
| -- `ThirdwebManager.Instance.SDK.Wallet.Connect` is now `ThirdwebManager.Instance.ConnectWallet` |
48 |
| -- The `ThirdwebManager` now can handle multiple wallet connections and tracks the active wallet, you may set it yourself too. |
49 |
| -- These functions will return `ThirdwebContract` and `IThirdwebWallet` type objects that have plenty of extensions to play with! |
50 |
| - |
51 |
| -That's really it for the Unity side of things, the rest is all handled internally to bridge the gap between raw .NET and Unity! |
52 |
| -- Much cleaner and lighter Unity package. |
53 |
| -- The .NET SDK was designed in a composable way while preserving the simple APIs we all know and love. |
54 |
| -- Connect to as many wallets as you like in parallel! |
55 |
| -- Use different settings for every connection. |
56 |
| -- No AWS SDK dependency, Nethereum is now also only used for types, using thirdweb infrastructure is now a much more optimized experience. |
57 |
| -- No behavioral differences cross-platform, what you see in the editor is what you get in WebGL, Standalone and Mobile runtime platforms. |
| 47 | +## Note: |
| 48 | +To achieve full .NET core functionality for WebGL, we include [WebGLThreadingPatcher](https://github.com/VolodymyrBS/WebGLThreadingPatcher), which makes async tasks blocking on the main thread. This is due to Unity's lack of support for C# multithreading in WebGL. This mainly affects InAppWallet initial creation (not session resuming). |
58 | 49 |
|
59 | 50 | # Getting Started
|
60 | 51 |
|
61 |
| -Head over to the [releases](https://github.com/thirdweb-dev/unity-sdk/releases) page and download the latest `.unitypackage` file. |
62 |
| - |
63 |
| -Try out `Scene_Playground` to explore some of the functionality and get onboarded to the SDK nicely! |
| 52 | +1. **Download:** Head over to the [releases](https://github.com/thirdweb-dev/unity-sdk/releases) page and download the latest `.unitypackage` file. |
| 53 | +2. **Explore:** Try out `Scene_Playground` to explore functionality and get onboarded. |
| 54 | +3. **Learn:** Explore the [.NET SDK Documentation](https://portal.thirdweb.com/dotnet) to find full API references. |
64 | 55 |
|
65 | 56 | **Notes:**
|
66 |
| -- The SDK has been tested on Web, Desktop and Mobile platforms using Unity 2021 and 2022 LTS. We **highly recommend** using 2022 LTS. |
67 |
| -- The example scenes are built using Unity 2022 LTS, they may look off in previous versions of Unity. |
68 |
| -- The Newtonsoft DLL is included as part of the Unity Package, feel free to deselect it if you already have it installed as a dependency to avoid conflicts. |
69 |
| -- If using .NET Framework and encountering an error related to HttpUtility, create a file `csc.rsp` that includes `-r:System.Web.dll` and save it under `Assets`. |
70 |
| -- If you have conflicting DLLs from other SDKs, in most cases our SDK will be compatible with previous versions, use version control and test removing duplicates. |
71 |
| - |
| 57 | +- Tested on Unity 2021 and 2022 LTS. Highly recommend using 2022 LTS. |
| 58 | +- Example scenes are built with Unity 2022 LTS; they may look off in earlier versions. |
| 59 | +- Newtonsoft DLL included; deselect if already installed to avoid conflicts. |
| 60 | +- If using .NET Framework and encountering `HttpUtility` errors, create `csc.rsp` with `-r:System.Web.dll` under `Assets`. |
| 61 | +- Use version control and test removing duplicate DLLs if conflicts arise. |
72 | 62 |
|
73 | 63 | # Build Instructions
|
74 | 64 |
|
75 | 65 | ## General
|
76 | 66 |
|
77 |
| -- Use `Smaller (faster) Builds` in the Build Settings (IL2CPP Code Generation in Unity 2022). |
78 |
| -- Use IL2CPP over Mono when possible in the Player Settings. |
79 |
| -- Using the SDK in the editor (pressing Play) is an accurate reflection of what you can expect to see on native platforms. |
80 |
| -- Set `Managed Stripping Level` to `Minimal` - you can find it under `Player Settings` > `Other Settings` > `Optimization` |
| 67 | +- **Build Settings:** Use `Smaller (faster) Builds` (IL2CPP Code Generation in Unity 2022). |
| 68 | +- **Player Settings:** Use IL2CPP over Mono. |
| 69 | +- **Stripping Level:** Set `Managed Stripping Level` to `Minimal` (`Player Settings` > `Other Settings` > `Optimization`). |
81 | 70 |
|
82 | 71 | ## WebGL
|
83 | 72 |
|
84 |
| -- When uploading a final build, set `Compression Format` to `Disabled` in `Player Settings` > `Publishing Settings`. |
85 |
| -- To test In-App Wallets (OAuth) you must host the build or run it locally yourself after adding the `Cross-Origin-Opener-Policy` header and setting it to `same-origin-allow-popups`. |
| 73 | +- **Compression Format:** Set to `Disabled` (`Player Settings` > `Publishing Settings`) for final builds. |
| 74 | +- **Testing In-App Wallets (Social Login):** Host the build or run it locally with `Cross-Origin-Opener-Policy` set to `same-origin-allow-popups`. |
86 | 75 |
|
87 |
| -Here's a simple way to do so, assuming you are in your WebGL build output folder: |
| 76 | +Example setup for testing In-App Wallet (Social Login) locally: |
88 | 77 |
|
89 |
| -```csharp |
| 78 | +```javascript |
| 79 | +// YourWebGLOutputFolder/server.js |
90 | 80 | const express = require('express');
|
91 | 81 | const app = express();
|
92 | 82 | const port = 8000;
|
93 | 83 |
|
94 |
| -app.use(function(req, res, next) { |
| 84 | +app.use((req, res, next) => { |
95 | 85 | res.header('Cross-Origin-Opener-Policy', 'same-origin-allow-popups');
|
96 | 86 | next();
|
97 | 87 | });
|
98 | 88 |
|
99 | 89 | app.use(express.static('.'));
|
100 | 90 | app.listen(port, () => console.log(`Server running on http://localhost:${port}`));
|
| 91 | + |
| 92 | +// run it with `node server.js` |
101 | 93 | ```
|
102 | 94 |
|
103 |
| -Once again, please note that no action is needed for hosted builds. |
| 95 | +No action needed for hosted builds. |
104 | 96 |
|
105 | 97 | ## Mobile
|
106 | 98 |
|
107 |
| -- Our package comes with EDM4U which resolves dependencies at runtime, you may Force Resolve from the `Assets` menu > `External Dependency Manager` > `Android Resolver` > `Force Resolve` before building your game or edit its settings as you please. |
108 |
| -- If using InAppWallet OAuth on mobile, make sure custom schemes matching your bundle id are set in your `Plugins/AndroidManifest.xml` or equivalent. It should be set to your bundle id, for instance `com.thirdweb.unitysdk` |
109 |
| - |
| 99 | +- **EDM4U:** Comes with the package, resolves dependencies at runtime. Use `Force Resolve` from `Assets` > `External Dependency Manager` > `Android Resolver`. |
| 100 | +- **Custom Schemes:** Set custom schemes matching your bundle ID in `Plugins/AndroidManifest.xml` or equivalent for InAppWallet OAuth. |
110 | 101 |
|
111 | 102 | # Need Help?
|
112 | 103 |
|
113 |
| -If you're unsure about something or need help, feel free to reach out though our [Support Portal](https://thirdweb.com/support). |
| 104 | +For any questions or support, visit our [Support Portal](https://thirdweb.com/support). |
114 | 105 |
|
115 |
| -Thank you for trying out the thirdweb Unity SDK! |
| 106 | +Thank you for trying out the Thirdweb Unity SDK! |
0 commit comments