A demo Unity Android app showcasing the Solana.Unity-SDK Mobile Wallet Adapter v2 API. Covers authentication, transaction signing, and wallet lifecycle management.
- Unity 6 (6000.4+) with Android Build Support (IL2CPP)
- An MWA-compatible wallet installed on the device: Phantom or Solflare
- An Android device or Solana Seeker
- Clone this repository
- Clone the Solana.Unity-SDK
- Open
Packages/manifest.jsonand update thecom.solana.unity_sdkpath to point at your local SDK clone:"com.solana.unity_sdk": "file:/path/to/your/Solana.Unity-SDK"
- Open the project in Unity
- Switch to Android platform in Build Settings (Player Settings: IL2CPP, ARM64)
Authentication lifecycle with all session management methods:
- Login — authorize with wallet (silent reconnect if cached session exists)
- Sign-In With Solana (SIWS) — authorize + sign a proof message in a single wallet interaction
- Reconnect — restore a cached session without opening the wallet
- Disconnect — clear local state (cache + auth token)
- Deauthorize — revoke the session at the wallet level
- Clone Authorization — create a second independent auth token from the current session
- Network Switching — switch between DevNet and MainNet (clears cache on switch)
Wallet operations (navigate here after connecting in the Auth scene):
- SignTransaction — sign a single transaction
- SignAllTransactions — sign a batch of transactions
- SignMessage — sign an arbitrary message string
- SignAndSendTransactions — sign and broadcast a transaction, with exhaustive result handling
- GetCapabilities — query the wallet's supported features and limits
Assets/Scripts/
AdapterManager.cs Singleton managing the SolanaMobileWalletAdapter instance,
network switching, and auto-reconnect on app launch
AuthScreenController.cs Auth scene UI — buttons for all session methods
OperationsScreenController.cs Operations scene UI — buttons for signing and capabilities
DemoAuthorizationCache.cs Custom IAuthorizationCache using a dedicated PlayerPrefs key
SceneNavigator.cs Scene loading utility
DemoBuild.cs Editor-only CLI build helper
From Unity: File > Build Settings > Build (Android selected)
From CLI:
Unity -batchmode -nographics -projectPath . -quit -buildTarget Android -executeMethod DemoBuild.BuildApkThe APK is written to Builds/Demo.apk.
Build the APK, install on an Android device with Phantom or Solflare, and walk through both scenes. The Auth scene covers the full session lifecycle; the Operations scene covers all signing and query methods.