unity接入mopub教程第三方的网络教程

unity接入mopub教程第三方的网络教程

1.可以先到官方这样看一下教程,接入比较简单 https://developers.mopub.com/zh/publishers/unity/integrate/ 2.SDK下载地址:https://github.com/mopub/mopub-unity-sdk/releases/ 3.现在主要讲一下插入第三方的广告网络设置像unity接入mopub,然后再把Yandex聚成在...

1.可以先到官方这样看一下教程,接入比较简单 https://developers.mopub.com/zh/publishers/unity/integrate/
2.SDK下载地址:https://github.com/mopub/mopub-unity-sdk/releases/
3.现在主要讲一下插入第三方的广告网络设置像unity接入mopub,然后再把Yandex聚成在mopub里面如图1

图 1

4.因为yandex不是mopub自己SDK里面的网络设置,我们这里需要接自定义网络。这里需要yandex有这个mopub的支持才可以接的入的,因为yanddex的官网上有说明https://yandex.com/dev/mobile-ads/doc/android/adapters/mopub-adapter.html
1)这里要创建一下mopub那边yandex的网络脚本

#if mopub_manager
using UnityEngine;

public class YandexNetworkConfig : MoPubNetworkConfig
{
    public override string AdapterConfigurationClassName
    {
        get
        {
            return Application.platform == RuntimePlatform.Android
                ? "com.mopub.mobileads.YandexMobileAdsMoPubAdapters"
                : "YandexMobileAdsMoPubAdapters";
        }
    }
}
#endif

2)然后再加一下Editor文件下的脚本,主要功能是加入到grade里的引用库
implementation ‘com.yandex.ads.adapter:mopub-mobileads:0.5.0’ // Assets/MoPub/Mediation/YandexMobileAds/Editor/MopubMobileadsMediationDependencies.xml:17
implementation ‘com.yandex.android:mobileads:4.1.0’ // Assets/MoPub/Mediation/YandexMobileAds/Editor/MopubMobileadsMediationDependencies.xml:7
implementation ‘com.yandex.android:mobmetricalib:3.20.2’ // Assets/MoPub/Mediation/YandexMobileAds/Editor/MopubMobileadsMediationDependencies.xml:12

https://maven.google.com/https://maven.google.com/https://maven.google.com/https://github.com/CocoaPods/Specs

3)然后这个脚本可加可不加的,主要是作用到mopub的面板上

image.png
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class YandexPackageConfig : PackageConfig
{
    public override string Name
    {
        get { return "Yandex"; }
    }

    public override string Version
    {
        get { return "1.1.0"; }
    }

    public override Dictionary NetworkSdkVersions
    {
        get {
            return new Dictionary
            {
                { Platform.ANDROID,"0.5.0"},
                { Platform.IOS,"4.1.2"}
            };
        }
    }
   

    public override Dictionary AdapterClassNames
    {
        get
        {
            return new Dictionary
            {
                { Platform.ANDROID,"com.mopub.mobileads.Yandex"},
                { Platform.IOS,"Yandex"}
            };
        }
    }
}

然后剩下就是mopub的后台配置了,这个简单就不发图了

image.png

只要这样操作就可以通了

文章来源于互联网:unity接入mopub教程第三方的网络教程

0

评论0

鱼翔浅底,鹰击长空,驼走大漠
没有账号? 注册  忘记密码?