Capacitor plugin for Unity Ads integration with support for rewarded video and interstitial ads
npm install capacitor-unity-adsplugin per gestire ads unity
``bash`
npm install capacitor-unity-ads
npx cap sync
* initialize(...)
* loadRewardedVideo(...)
* showRewardedVideo()
* isRewardedVideoLoaded()
* loadInterstitial(...)
* showInterstitial()
* isInterstitialLoaded()
* setTestMode(...)
* getVersion()
* Interfaces
`typescript`
initialize(options: { gameId: string; testMode?: boolean; }) => Promise
Initialize Unity Ads SDK
| Param | Type |
| ------------- | ---------------------------------------------------- |
| options | { gameId: string; testMode?: boolean; } |
--------------------
`typescript`
loadRewardedVideo(options: { placementId: string; }) => Promise
Load a rewarded video ad
| Param | Type |
| ------------- | ------------------------------------- |
| options | { placementId: string; } |
--------------------
`typescript`
showRewardedVideo() => Promise<{ success: boolean; reward?: RewardInfo; }>
Show a rewarded video ad
Returns: Promise<{ success: boolean; reward?: RewardInfo; }>
--------------------
`typescript`
isRewardedVideoLoaded() => Promise<{ loaded: boolean; }>
Check if rewarded video ad is loaded
Returns: Promise<{ loaded: boolean; }>
--------------------
`typescript`
loadInterstitial(options: { placementId: string; }) => Promise
Load an interstitial ad
| Param | Type |
| ------------- | ------------------------------------- |
| options | { placementId: string; } |
--------------------
`typescript`
showInterstitial() => Promise<{ success: boolean; }>
Show an interstitial ad
Returns: Promise<{ success: boolean; }>
--------------------
`typescript`
isInterstitialLoaded() => Promise<{ loaded: boolean; }>
Check if interstitial ad is loaded
Returns: Promise<{ loaded: boolean; }>
--------------------
`typescript`
setTestMode(options: { enabled: boolean; }) => Promise
Set test mode
| Param | Type |
| ------------- | ---------------------------------- |
| options | { enabled: boolean; } |
--------------------
`typescript`
getVersion() => Promise<{ version: string; }>
Get Unity Ads version
Returns: Promise<{ version: string; }>
--------------------
#### RewardInfo
| Prop | Type |
| ------------ | ------------------- |
| type | string |
| amount` | number |