Unity Package Manager (UPM) SDK for MSP interstitial ads on Android and iOS.
- Unity packages:
ai.themsp.unity.core+ optionalai.themsp.unity.adapter.* - Native Android: Maven Central (
ai.themsp:*) - Native iOS: CocoaPods trunk (
MSPCoreand adapter pods) - Current package version: see
tools/release/VERSION(now4.5.0-rc.5)
msp-unity-sdk/
├── upm/ # ai.themsp.unity.core (required UPM package)
│ ├── Runtime/ # C# API: MSP, MSPAdLoader, interstitial
│ ├── Editor/ # iOS postprocess, EDM Dependencies.xml
│ └── Plugins/
│ ├── Android/ # shipped msp-unity-bridge-release.aar
│ └── iOS/ # Swift / ObjC bridge
├── packages/
│ └── adapter-*/ # optional network adapters (Nova, Google, …)
├── android-bridge/ # Gradle module that builds the bridge AAR
├── demo/ # sample Unity project
├── docs/publishing-layout.md # package matrix & native coordinates
├── tools/release/ # VERSION, validate, sync, pack
└── build/ # generated .tgz (gitignored)
| Path | Role |
|---|---|
upm/ |
Publishable core package |
packages/adapter-* |
Optional adapters; install only what you need |
android-bridge/ |
Builds / updates the Android bridge AAR |
demo/ |
End-to-end integration sample |
tools/release/VERSION |
Single source of Unity package version |
Adapter list and native Maven/pod names: docs/publishing-layout.md.
- Unity 2021.3+ (demo tested on Unity 6000.x)
- Android: External Dependency Manager for Unity (EDM4U)
- iOS: CocoaPods (
podonPATH), Xcode 15+, iOS 15+ deployment target - Network access to Maven Central, Google Maven, and CocoaPods CDN
Install core plus the adapters you need via one of:
A. Git tag (recommended for remote install)
{
"dependencies": {
"ai.themsp.unity.core": "https://github.com/ParticleMedia/msp-unity-sdk.git?path=/upm#v4.5.0-rc.5",
"ai.themsp.unity.adapter.nova": "https://github.com/ParticleMedia/msp-unity-sdk.git?path=/packages/adapter-nova#v4.5.0-rc.5",
"com.google.external-dependency-manager": "https://github.com/googlesamples/unity-jar-resolver.git?path=upm"
}
}Use the same tag for every MSP package. Change the GitHub host/path when you publish from another remote.
B. Local monorepo (day-to-day SDK development)
{
"dependencies": {
"ai.themsp.unity.core": "file:../../upm",
"ai.themsp.unity.adapter.nova": "file:../../packages/adapter-nova"
}
}C. Tarball
./tools/release/build-packages.shThen in Packages/manifest.json:
"ai.themsp.unity.core": "file:../build/ai.themsp.unity.core-4.5.0-rc.5.tgz",
"ai.themsp.unity.adapter.nova": "file:../build/ai.themsp.unity.adapter.nova-4.5.0-rc.5.tgz"- Ensure EDM4U is installed.
- Enable a custom Gradle settings template if required by your Unity version.
- Assets → External Dependency Manager → Android Resolver → Force Resolve.
- If you use the Google adapter, set
com.google.android.gms.ads.APPLICATION_IDin the Android manifest (Google provides sample App IDs for testing).
The bridge AAR ships inside ai.themsp.unity.core at Plugins/Android/msp-unity-bridge-release.aar. Native MSP / mediation libs resolve from Maven Central.
- Switch platform to iOS and Build (export Xcode project).
- Postprocess generates a
Podfilefrom installed adapters and runspod install(CocoaPods trunk by default). - Open
Unity-iPhone.xcworkspaceand run on device.
Optional env vars:
| Variable | Effect |
|---|---|
MSP_UNITY_SKIP_POD_INSTALL=1 |
Skip automatic pod install |
MSP_UNITY_USE_LOCAL_IOS_SDK=1 |
Use local :path pods (requires MSP_IOS_SDK_PATH) |
MSP_IOS_SDK_PATH=/path/to/ios-sdk |
Local MSP iOS SDK checkout for pod / Gemfile override |
MSP_UNITY_GAD_APP_ID=… |
Override Google Ads App ID written into Info.plist |
MSP.Initialize(new MSPInitializationParameters
{
PrebidApiKey = "YOUR_API_KEY",
SourceApp = "YOUR_IOS_APP_STORE_ID",
OrgId = YOUR_ORG_ID,
AppId = YOUR_APP_ID,
PrebidHost = "https://msp.newsbreak.com",
Parameters = new Dictionary<string, object>
{
#if UNITY_IOS && !UNITY_EDITOR
[MSPConstants.Ios.InitParamKeyMolocoAppKey] = "YOUR_MOLOCO_APP_KEY",
[MSPConstants.Ios.InitParamKeyPrebidBidRequestTimeoutMillis] = 30000,
#else
[MSPConstants.Android.InitParamKeyMolocoAppKey] = "YOUR_MOLOCO_APP_KEY",
[MSPConstants.Android.InitParamKeyPrebidBidRequestTimeoutMillis] = 30000,
#endif
},
AppPackageName = "com.example.app", // Android only
AppVersionName = "1.0.0", // Android only
IsInTestMode = true
}, (success, message) => { /* … */ });
// Prefer a new MSPAdLoader for each load (matches native AdLoader lifecycle).
var loader = new MSPAdLoader();
var request = new MSPAdRequest(placementId);
request.TestParams["test_ad"] = true;
request.TestParams["ad_network"] = "msp_nova";
// request.CustomParams["your_key"] = "your_value";
loader.LoadAd(placementId, listener, request);
// in OnAdLoaded:
var ad = loader.GetAd(placementId) as MSPInterstitialAd;
ad?.Show();
loader.Dispose(); // when finished with this loaderAPI scope today: interstitial only (Initialize / LoadAd / GetAd / Show). Create a new MSPAdLoader for each ad load.
Open demo/ in Unity. The sample resolves MSP packages from the public git tag shown above. For local iteration, switch Packages/manifest.json back to file:../../upm and file:../../packages/adapter-nova.
Unity package version is owned by one file: tools/release/VERSION.
# Publish version: sync package.json, commit, tag vX.Y.Z, push origin
./tools/release/publish.sh 0.0.2-rc.0
# Also rebuild bridge AAR and pack build/*.tgz
./tools/release/publish.sh 0.0.2-rc.0 --pack
# Preview only
./tools/release/publish.sh 0.0.2-rc.0 --dry-runManual equivalent:
echo '0.0.2-rc.0' > tools/release/VERSION
./tools/release/build-packages.sh
git add -u && git commit -m "chore(release): bump Unity package version to 0.0.2-rc.0"
git tag -a "v0.0.2-rc.0" -m "MSP Unity SDK 0.0.2-rc.0"
git push origin main && git push origin "v0.0.2-rc.0"Notes:
- Do not hand-edit
versionin individualpackage.jsonfiles;sync-package-versions.shoverwrites them fromVERSION. - Native MSP versions (Android Maven / iOS pods) live in
upm/Runtime/Adapter/MSPUnityNativeVersions.csand are independent of the Unity package version. - Push target is
origin(override withMSP_UNITY_ORIGIN_REMOTE). - Full checklist and package matrix:
docs/publishing-layout.md.
cd android-bridge
make install # → demo/Assets/Plugins/Android/
UNITY_PLUGINS_DIR=../upm/Plugins/Android make install # → core packageRequires ./gradlew or gradle on PATH (override with GRADLEW=…).
docs/publishing-layout.md— adapters, native coordinates, install variantsupm/README.md— core package status / API notesandroid-bridge/README.md— AAR build details