---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://ads.yandex.com/helpcenter/en/dev/unity/release/8-0-0-migration.md
  - https://ads.yandex.com/helpcenter/ru/dev/unity/release/8-0-0-migration.md
  - https://ads.yandex.com/helpcenter/zh/dev/unity/release/8-0-0-migration.md
  - href: en/dev/unity/release/8-0-0-migration.md
    type: text/markdown
    title: Markdown version
  - href: ../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://ads.yandex.com/helpcenter/en/llms.txt

<!--
Used in Boost: boost/en/ad-monetization/dev/unity
-->

# Guide for migrating to version 8

Yandex Mobile Ads Unity plugin 8.0.0 changes several APIs to improve the developer experience.

## Main changes

### 1. `AdRequest` changes

`AdRequestConfiguration` and `AdRequest.Builder` are removed. `adUnitId` is a required `AdRequest` constructor argument. `AdRequest` is now used for Interstitial, Rewarded, and AppOpen loaders instead of `AdRequestConfiguration`.


| Class | Status |
|-------|--------|
| `AdRequestConfiguration` | Removed. Use `AdRequest` |
| `AdRequest.Builder` | Removed. Use the `AdRequest` constructor |

##### Examples

###### C#

#|
|| SDK 7 | SDK 8 ||
||
```csharp
// Interstitial / Rewarded / AppOpen
AdRequestConfiguration config =
    new AdRequestConfiguration.Builder("R-M-XXXXX-YY")
        .Build();
interstitialAdLoader.LoadAd(config);

// Banner
Banner banner = new Banner(
    "R-M-XXXXX-YY",
    BannerAdSize.StickySize(320),
    AdPosition.BottomCenter);
banner.LoadAd(new AdRequest.Builder().Build());
``` 
|
```csharp
// Interstitial / Rewarded / AppOpen
AdRequest request = new AdRequest("R-M-XXXXX-YY");
interstitialAdLoader.LoadAd(request);

// Banner
Banner banner = new Banner(
    BannerAdSize.Sticky(320),
    AdPosition.BottomCenter);
banner.LoadAd(new AdRequest("R-M-XXXXX-YY"));
```
||
|#

### 2. Targeting changes

Targeting fields (`Age`, `Gender`, `Location`, `ContextQuery`, `ContextTags`) are removed from `AdRequestConfiguration.Builder` and `AdRequest.Builder`. Use the new `AdTargeting` class.

| Class | Property | Status |
|-------|----------|--------|
| `AdRequestConfiguration.Builder` | `WithAge` | Removed. Use `AdTargeting(age:)` |
| `AdRequestConfiguration.Builder` | `WithGender` | Removed. Use `AdTargeting(gender:)` |
| `AdRequestConfiguration.Builder` | `WithLocation` | Removed. Use `AdTargeting(location:)` |
| `AdRequestConfiguration.Builder` | `WithContextQuery` | Removed. Use `AdTargeting(contextQuery:)` |
| `AdRequestConfiguration.Builder` | `WithContextTags` | Removed. Use `AdTargeting(contextTags:)` |
| `AdRequest.Builder` | `WithAge` | Removed. Use `AdTargeting(age:)` |
| `AdRequest.Builder` | `WithGender` | Removed. Use `AdTargeting(gender:)` |
| `AdRequest.Builder` | `WithLocation` | Removed. Use `AdTargeting(location:)` |
| `AdRequest.Builder` | `WithContextQuery` | Removed. Use `AdTargeting(contextQuery:)` |
| `AdRequest.Builder` | `WithContextTags` | Removed. Use `AdTargeting(contextTags:)` |
| `AdTargeting` | — | Added |

##### Examples

###### C#

#|
|| SDK 7| SDK 8 ||
||
```csharp
AdRequestConfiguration config =
    new AdRequestConfiguration.Builder("R-M-XXXXX-YY")
        .WithAge("25")
        .WithGender(Gender.MALE)
        .WithLocation(location)
        .WithContextQuery("coffee")
        .WithContextTags(new List<string> { "food", "drinks" })
        .WithParameters(parameters)
        .Build();
```
|
```csharp
AdTargeting targeting = new AdTargeting(
    age: "25",
    gender: Gender.MALE,
    location: location,
    contextQuery: "coffee",
    contextTags: new List<string> { "food", "drinks" });

AdRequest request = new AdRequest(
    "R-M-XXXXX-YY",
    targeting: targeting,
    parameters: parameters);
```
||
|#

### 3. Ad loader changes

`OnAdLoaded` and `OnAdFailedToLoad` are removed from `RewardedAdLoader`, `InterstitialAdLoader`, and `AppOpenAdLoader`. Load results are delivered via `LoadAd` callback parameters.

| Class | Loader | Status |
|-------|--------|--------|
| `AppOpenAdLoader` | `LoadAd(request)` + `OnAdLoaded`, `OnAdFailedToLoad` | Replaced with `LoadAd(request, onLoaded, onFailed)` |
| `InterstitialAdLoader` | `LoadAd(request)` + `OnAdLoaded`, `OnAdFailedToLoad` | Replaced with `LoadAd(request, onLoaded, onFailed)` |
| `RewardedAdLoader` | `LoadAd(request)` + `OnAdLoaded`, `OnAdFailedToLoad` | Replaced with `LoadAd(request, onLoaded, onFailed)` |
| `OnAdLoaded` | — | Removed |
| `OnAdFailedToLoad` | — | Removed |

##### Examples

###### C#

#|
|| SDK 7| SDK 8 ||
||
```csharp
var loader = new RewardedAdLoader();
loader.OnAdLoaded += (sender, args) => {
    _rewardedAd = args.RewardedAd;
};
loader.OnAdFailedToLoad += (sender, args) => {
    Debug.Log(args.Message);
};
loader.LoadAd(new AdRequest("R-M-XXXXX-YY"));
```
|
```csharp
var loader = new RewardedAdLoader();
loader.LoadAd(
    adRequest: new AdRequest("R-M-XXXXX-YY"),
    onLoaded: ad => { _rewardedAd = ad; },
    onFailed: args => { Debug.Log(args.Message); });
```
||
|#

The same pattern applies to `InterstitialAdLoader` (returns `Interstitial`) and `AppOpenAdLoader` (returns `AppOpenAd`).


#### 3.1 Async/await support

All ad loaders support async/await. Failed loads throw `AdLoadingException`.

| Loader | Method | Status |
|--------|--------|--------|
| `AppOpenAdLoader` | `LoadAd(request)` | Added |
| `InterstitialAdLoader` | `LoadAd(request)` | Added |
| `RewardedAdLoader` | `LoadAd(request)` | Added |

##### Examples

###### C#

```csharp
var loader = new RewardedAdLoader();
try
{
    _rewardedAd = await loader.LoadAd(new AdRequest("R-M-XXXXX-YY"));
}
catch (AdLoadingException e)
{
    Debug.Log(e.Message);
}
```

### 4. Banner API changes

The `blockId` constructor argument is removed from `Banner`. The ad unit ID is passed via `AdRequest` on each load. `BannerAdSize` factory methods drop the `Size` suffix.

| Class | SDK 7 | SDK 8 | Status |
|-------|-------|-------|--------|
| `Banner` | `Banner(blockId, adSize, position)` | `Banner(adSize, position)` | Changed |
| `Banner` | `LoadAd(new AdRequest.Builder().Build())` | `LoadAd(new AdRequest(blockId))` | Changed |
| `BannerAdSize` | `FixedSize(width, height)` | `Fixed(width, height)` | Renamed |
| `BannerAdSize` | `StickySize(width)` | `Sticky(width)` | Renamed |
| `BannerAdSize` | `InlineSize(width, maxHeight)` | `Inline(width, maxHeight)` | Renamed |

##### Examples

###### C#

#|
|| SDK 7| SDK 8 ||
||
```csharp
BannerAdSize sticky = BannerAdSize.StickySize(320);
Banner banner = new Banner(
    "R-M-XXXXX-YY",
    sticky,
    AdPosition.BottomCenter);
banner.LoadAd(new AdRequest.Builder().Build());
```
|
```csharp
BannerAdSize sticky = BannerAdSize.Sticky(320);
Banner banner = new Banner(
    sticky,
    AdPosition.BottomCenter);
banner.LoadAd(new AdRequest("R-M-XXXXX-YY"));
```
||
|#

### 5. Main SDK class rename

`MobileAds` is renamed to `YandexAds`.

| SDK 7 | SDK 8 | Status |
|-------|-------|--------|
| `MobileAds` | `YandexAds` | Renamed |
| `MobileAds.SetUserConsent(consent)` | `YandexAds.SetUserConsent(consent)` | Renamed |
| `MobileAds.SetLocationTracking(enabled)` | `YandexAds.SetLocationTracking(enabled)` | Renamed |
| `MobileAds.SetAgeRestricted(restricted)` | `YandexAds.SetAgeRestricted(restricted)` | Renamed |
| `MobileAds.ShowDebugPanel()` | `YandexAds.ShowDebugPanel()` | Renamed |

##### Examples

###### C#

#|
|| SDK 7| SDK 8 ||
||
```csharp
MobileAds.SetUserConsent(true);
MobileAds.SetLocationTracking(true);
MobileAds.SetAgeRestricted(false);
```
|
```csharp
YandexAds.SetUserConsent(true);
YandexAds.SetLocationTracking(true);
YandexAds.SetAgeRestricted(false);
```
||
|#

### 6. `AdInfo` changes

`AdSize` is removed from `AdInfo`. New properties: `ExtraData`, `PartnerText`, `Creatives`.

| Class | SDK 7 | SDK 8 | Status |
|-------|-------|-------|--------|
| `AdInfo` | `AdUnitId` | `AdUnitId` | Unchanged |
| `AdInfo` | `AdSize` | — | Removed |
| `AdInfo` | — | `ExtraData` | Added |
| `AdInfo` | — | `PartnerText` | Added (ADFOX only) |
| `AdInfo` | — | `Creatives` | Added |

##### Examples

###### C#

#|
|| SDK 7| SDK 8 ||
||
```csharp
string adUnitId = adInfo.AdUnitId;
AdSize adSize = adInfo.AdSize;
```
|
```csharp
string adUnitId = adInfo.AdUnitId;
string extraData = adInfo.ExtraData;
string partnerText = adInfo.PartnerText; // ADFOX only

if (adInfo.Creatives != null)
{
    foreach (Creative creative in adInfo.Creatives)
    {
        string creativeId = creative.CreativeId;
        string campaignId = creative.CampaignId;
        string placeId    = creative.PlaceId;
    }
}
```
||
|#


### 7. `GetInfo()` availability

`GetInfo()` is available for all ad types, including `AppOpenAd` and `Banner`.

| Ad type | SDK 7 | SDK 8 | Status |
|---------|-------|-------|--------|
| `Interstitial.GetInfo()` | ✓ | ✓ | Unchanged |
| `RewardedAd.GetInfo()` | ✓ | ✓ | Unchanged |
| `AppOpenAd.GetInfo()` | — | ✓ | Added |
| `Banner.GetInfo()` | — | ✓ | Added |

##### Examples

###### C#

```csharp
// SDK 8: GetInfo() for all ad types
AdInfo adInfo = banner.GetInfo();
if (adInfo != null)
{
    Debug.Log($"AdUnitId: {adInfo.AdUnitId}");
}
```
