Unity SDK Prerequisites
Integrate powerful Web3.0 Unity SDK in minutes
- Install Unity 2020.3.26f1 or later. Earlier versions may also be compatible but will not be actively supported.
- (iOS only) Install the following:
- Xcode 13.3.1 or higher
- CocoaPods 1.10.0 or higher
- Make sure that your Unity project meets these requirements:
- For iOS — targets iOS 13 or higher
Before you can add our Auth Service to your Unity game, you need to create a Particle project to connect to your iOS and Android app. Visit Particle Dashboard to learn more about Particle projects and apps.
- Configure scheme url in Unity Editor
- 2.Select Other, then scroll down to Configuration.
- 3.Expand the Supported URL schemes section and, in the Element 0 field, enter the URL scheme to associate with your application. For example, if your project app id is "63bfa427-cf5f-4742-9ff1-e8f5a1b9828f", your scheme URL is "pn63bfa427-cf5f-4742-9ff1-e8f5a1b9828f"
- Remove other service code if you don't need them.
- 1.In ParticleNetworkIOSBridge.cs, there are 5 part ParticleNetworkBase, ParticleAuthService, ParticleWalletAPI, ParticleWalletGUI, ParticleConnect, works for interact with iOS native. ParticleNetworkBase is required,
- 2.ParticleAuthService if required for Auth Service,
- 3.ParticleConnect is required for Connect Service.
- 4.You can remove other codes if you don't need them.
- Configure Xcode project after iOS build.
- 1.Create a Podfile if you don't already have one. From the root of your project directory, run the following command:pod init
- 2.To your Podfile, add select these pods that you want to use in your app:// ParticleWalletGUI contains all other services.pod 'ParticleWalletGUI'// ParticleAuthService provide auth service.pod 'ParticleAuthService'// PaticleConnectService privide wallet connect and auth service.pod 'ParticleConnect'pod 'CommonConnect'
- 3.Install the pods, then open your
.xcworkspacefile to see the project in Xcode:pod install --repo-updateopen your-project.xcworkspace
- Edit Podfile
- Configure Project information.
- 1.Create a ParticleNetwork-Info.plist into the root of your Xcode project
- 2.Copy the following text into this file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
YOUR_PROJECT_APP_UUIDwith the new values created in your Dashboard
particle.network.project_client_key=Your Project Client Key
particle.network.project_id=Your Project Client ID
particle.network.app_id=Your App ID
Android — Configuration file path is Assets/Plugins/Android/launcherTemplate.gradle
def sdkVersion = "0.4.1" //find the latest version of the sdk here:https://search.maven.org/search?q=g:network.particle
//particle auth service (Required)
//particle api service (Optional.) If you don't want to use the API service, you can remove this dependency.
//particle wallet service (Optional.) If you don't want to use the wallet service, you can remove this dependency.
//particle unity bridge (Required)
AppDelegate.swiftfrom under github
/Assets/Plugins/iOS/.Swift, Copy files into the root of your Xcode project. Xcode will ask you if auto create Bridging file, click yes.
2.Make sure Build Settings, Swift Compiler - General, has Objective-C Bridging Header, its connect is Unity-iPhone-Bridging-Header.h 's local path.
main.mmunder MainApp folder.
/Assets/Plugins/iOSis NativeCallProxy files, they are requested by Unity to interact with iOS code. Remove code under Particle Wallet API and Particle Wallet GUI if you don't need wallet service.
UnityManger.swift, it has implemented methods defined in
6. Select NativeCallProxy.h, in the file inspector, check public in Target Membership.
7. If you want to use ParticleConnect, you should add LSApplicationQueriesSchemes to info.plist.
8. If you are skilled in iOS, you can modify these files as you like. For example, add other services.
- 1.In demo, after login tap Sign And Send Transaction encounter failed or error?
In demo, we create a test transaction, that send some tokens in Ethereum Goerli Testnet, after you login from particle auth, other wallet or private key, your account may not have enough tokens.
you could get some test tokens from out test account, in file
TestAccount.cs, we provide private keys for you to test in demo.
or get test tokens from the following URL
Before sign and send transaction, make sure you have enough token to finish the transaction.
- 1.After export to Xcode project, when you encounter error ''Module complied with Swift 5.6.1 cannot be imported by the Swift 5.7 complier'' ?
Firstly, check the Podfile, do you add the code in Edit Podfile in Prerequistites.
Secondly, check the Podfile, do you add the pods to under right target.
more pod version information is here.
Here is an example in Podfile. All particle pods should under target 'Unity-iPhone' not target 'UnityFramework’.
platform :ios, '13.0'
target 'Unity-iPhone' do
pod 'ParticleWalletGUI', '0.8.9’
pod 'ParticleAuthService', '0.8.9’
pod 'ParticleWalletAPI', '0.8.9’
pod 'ParticleNetworkBase', '0.8.9’
pod 'ParticelWalletConnect', '0.8.9'
pod 'ConnectWalletConnectAdapter', '0.1.34’
pod 'ConnectEVMAdapter', '0.1.34’
pod 'ConnectSolanaAdapter', '0.1.34’
pod 'ParticleConnect', '0.1.34’
pod 'ConnectCommon', '0.1.34’
target 'UnityFramework' do
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
2. After export to Xcode project, when you encounter error ''Cannot find type 'NativeCallsProtocol'.h in scope''.
Make sure you have changed NativaProxy.h from project to public, select this file, then in the right area, you can see a Target Membership, in iOS step-5.
3. When execute pod install in Terminal, encounter error “Unable to determine Swift version for the following pods”
Remove particle pods in podfile, then execute pod install, open Unity-iPhone.xcworkspace, select Unity-iPhone under TARGETS, in Building Settings, Swift Complier-Language, set swift version to swift 5, if there is no Swift Complier section, you should create an empty swift file, you can see swift version after do that.