# GoogleMobileAds.Api.RewardedAdPreloader

The preloader for rewarded ads.

## Summary

| ### Public static functions ||
|---|---|
| `https://developers.google.com/admob/unity/reference/class/google-mobile-ads/api/rewarded-ad-preloader#class_google_mobile_ads_1_1_api_1_1_rewarded_ad_preloader_1ad8e5d11eca38e9df767f7c1482057f6e(string preloadId)` | `https://developers.google.com/admob/unity/reference/class/google-mobile-ads/api/rewarded-ad#class_google_mobile_ads_1_1_api_1_1_rewarded_ad` Returns a preloaded ad and removes it from the cache. |
| `https://developers.google.com/admob/unity/reference/class/google-mobile-ads/api/rewarded-ad-preloader#class_google_mobile_ads_1_1_api_1_1_rewarded_ad_preloader_1a6fda5d5edb7cf957a12bdbf03634d33e(string preloadId)` | `void` Stops preloading for the given `preloadId` and destroys all associated preloaded ads. |
| `https://developers.google.com/admob/unity/reference/class/google-mobile-ads/api/rewarded-ad-preloader#class_google_mobile_ads_1_1_api_1_1_rewarded_ad_preloader_1aef04efba1491f52dc2b118888a192256()` | `void` Stops preloading and destroys preloaded ads for all preload configurations. |
| `https://developers.google.com/admob/unity/reference/class/google-mobile-ads/api/rewarded-ad-preloader#class_google_mobile_ads_1_1_api_1_1_rewarded_ad_preloader_1af319e0a20c2a582c6084ceeb9fa5ded5(string preloadId)` | `https://developers.google.com/admob/unity/reference/class/google-mobile-ads/api/preload-configuration#class_google_mobile_ads_1_1_api_1_1_preload_configuration` Get the rewarded ad [PreloadConfiguration](https://developers.google.com/admob/unity/reference/class/google-mobile-ads/api/preload-configuration#class_google_mobile_ads_1_1_api_1_1_preload_configuration) associated with the given preload ID, or null if one does not exist. |
| `https://developers.google.com/admob/unity/reference/class/google-mobile-ads/api/rewarded-ad-preloader#class_google_mobile_ads_1_1_api_1_1_rewarded_ad_preloader_1a9d8a1060410aee4a97ff5600c18c207e()` | `Dictionary< string, https://developers.google.com/admob/unity/reference/class/google-mobile-ads/api/preload-configuration#class_google_mobile_ads_1_1_api_1_1_preload_configuration >` Get a dictionary of all rewarded ad PreloadConfigurations, keyed by their associated preload ID, or an empty dictionary if no preloaders exist. |
| `https://developers.google.com/admob/unity/reference/class/google-mobile-ads/api/rewarded-ad-preloader#class_google_mobile_ads_1_1_api_1_1_rewarded_ad_preloader_1a88b730ff44a6437843896bdabcb1d79c(string preloadId)` | `int` Get the number of ads available for the given preload ID. |
| `https://developers.google.com/admob/unity/reference/class/google-mobile-ads/api/rewarded-ad-preloader#class_google_mobile_ads_1_1_api_1_1_rewarded_ad_preloader_1aab0c1e220203d3e481b59467b3dbb700(string preloadId)` | `bool` Determines whether at least one ad is available for the given `preloadId`. |
| `https://developers.google.com/admob/unity/reference/class/google-mobile-ads/api/rewarded-ad-preloader#class_google_mobile_ads_1_1_api_1_1_rewarded_ad_preloader_1a0d1c6dc34a683e7b927dd0e2d3c5d5dc(string preloadId)` | `https://developers.google.com/admob/unity/reference/class/google-mobile-ads/api/response-info#class_google_mobile_ads_1_1_api_1_1_response_info` Returns the [ResponseInfo](https://developers.google.com/admob/unity/reference/class/google-mobile-ads/api/response-info#class_google_mobile_ads_1_1_api_1_1_response_info) of a preloaded ad for the given preload ID without dequeuing it, or null if no ad is available. |
| `https://developers.google.com/admob/unity/reference/class/google-mobile-ads/api/rewarded-ad-preloader#class_google_mobile_ads_1_1_api_1_1_rewarded_ad_preloader_1a62f3c7907ec1edcf15f6e1df7dd835d6(string preloadId, https://developers.google.com/admob/unity/reference/class/google-mobile-ads/api/preload-configuration#class_google_mobile_ads_1_1_api_1_1_preload_configuration preloadConfiguration, Action< string, https://developers.google.com/admob/unity/reference/class/google-mobile-ads/api/response-info#class_google_mobile_ads_1_1_api_1_1_response_info > onAdPreloaded, Action< string, https://developers.google.com/admob/unity/reference/class/google-mobile-ads/api/ad-error#class_google_mobile_ads_1_1_api_1_1_ad_error > onAdFailedToPreload, Action< string > onAdsExhausted)` | `bool` Starts preloading rewarded ads from the configuration for the given preload ID. |

## Public static functions

### DequeueAd

```c#
RewardedAd DequeueAd(
  string preloadId
)
```
Returns a preloaded ad and removes it from the cache.

<br />

Details Parameters `preloadId` A string identifier used to preload the ads for that configuration. **Returns** The preloaded ad for the given preload ID, or null if no ad is available.

The ad returned may be any of the ads preloaded for `preloadId`. The order returned is not guaranteed to match the order of `OnAdAvailable` events.

### Destroy

```c#
void Destroy(
  string preloadId
)
```
Stops preloading for the given `preloadId` and destroys all associated preloaded ads.

<br />

Details Parameters `preloadId` The preload ID to stop preloading for.

### DestroyAll

```c#
void DestroyAll()
```
Stops preloading and destroys preloaded ads for all preload configurations.

### GetConfiguration

```c#
PreloadConfiguration GetConfiguration(
  string preloadId
)
```
Get the rewarded ad [PreloadConfiguration](https://developers.google.com/admob/unity/reference/class/google-mobile-ads/api/preload-configuration#class_google_mobile_ads_1_1_api_1_1_preload_configuration) associated with the given preload ID, or null if one does not exist.

### GetConfigurations

```c#
Dictionary< string, PreloadConfiguration > GetConfigurations()
```
Get a dictionary of all rewarded ad PreloadConfigurations, keyed by their associated preload ID, or an empty dictionary if no preloaders exist.

### GetNumAdsAvailable

```c#
int GetNumAdsAvailable(
  string preloadId
)
```
Get the number of ads available for the given preload ID.

<br />

Details Parameters `preloadId` The preload ID to check for available ads. **Returns** The number of ads available for the given preload ID.

### IsAdAvailable

```c#
bool IsAdAvailable(
  string preloadId
)
```
Determines whether at least one ad is available for the given `preloadId`.

<br />

Details Parameters `preloadId` The preload ID to check for availability. **Returns** True if there is an ad available for the given preload ID.

### PeekAdResponseInfo

```c#
ResponseInfo PeekAdResponseInfo(
  string preloadId
)
```
Returns the [ResponseInfo](https://developers.google.com/admob/unity/reference/class/google-mobile-ads/api/response-info#class_google_mobile_ads_1_1_api_1_1_response_info) of a preloaded ad for the given preload ID without dequeuing it, or null if no ad is available.

<br />

Details Parameters `preloadId` A string identifier used to preload the ads for that configuration. **Returns** The [ResponseInfo](https://developers.google.com/admob/unity/reference/class/google-mobile-ads/api/response-info#class_google_mobile_ads_1_1_api_1_1_response_info) of the preloaded ad for the given preload ID, or null if no ad is available.

### Preload

```c#
bool Preload(
  string preloadId,
  PreloadConfiguration preloadConfiguration,
  Action< string, ResponseInfo > onAdPreloaded,
  Action< string, AdError > onAdFailedToPreload,
  Action< string > onAdsExhausted
)
```
Starts preloading rewarded ads from the configuration for the given preload ID.

<br />

Details Parameters `preloadId` A string that uniquely identifies the `https://developers.google.com/admob/unity/reference/class/google-mobile-ads/api/preload-configuration#class_google_mobile_ads_1_1_api_1_1_preload_configuration`. Use this identifier when calling `DequeueAd` to retrieve a preloaded ad for this configuration. `preloadConfiguration` The configuration that dictates how ads are preloaded. `onAdPreloaded` Called when a new ad is available for the given preload ID. `onAdFailedToPreload` Called when an ad failed to load for a given preload ID. `onAdsExhausted` Called when the last available ad is exhausted for the given preload ID. **Returns** False if preloading fails to start.