unity---接入Admob

这篇具有很好参考价值的文章主要介绍了unity---接入Admob。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

目录

1.Admob SDK 下载地址

2.将下载好的unityPackage sdk导入到unity里

​编辑

 3.解析依赖到项目中

4.设置admob app ID

 5.android 测试Id

 6.IOS 测试ID

 7.测试 app ID

8. SDK初始化与使用示例代码

9.gradle 配置

10. gradle 下载地址


1.Admob SDK 下载地址

Admob SDK 下载地址

2.将下载好的unityPackage sdk导入到unity里

在 Unity 编辑器中打开您的项目,然后依次选择 Assets > Import Package > Custom Package,并找到您下载的 GoogleMobileAdsPlugin.unitypackage 文件。

unity---接入Admob

 3.解析依赖到项目中

在 Unity 编辑器中,依次选择 Assets > External Dependency Manager > Android Resolver > Resolve。Unity 外部依赖项管理器库会将声明的依赖项复制到 Unity 应用的 Assets/Plugins/Android 目录中。

4.设置admob app ID

在 Unity 编辑器中,从菜单中依次选择 Assets > Google Mobile Ads > Settingsunity---接入Admob

 5.android 测试Id

unity---接入Admob

 6.IOS 测试ID

unity---接入Admob

 7.测试 app ID

ca-app-pub-3940256099942544~3347511713

8. SDK初始化与使用示例代码

using UnityEngine;
using GoogleMobileAds.Api;
using System;
using GoogleMobileAds.Common;
using System.Collections.Generic;
using UnityEngine.Events;
using UnityEngine.UI;

public class AdsContr : Singleton<AdsContr>
{
    private readonly TimeSpan APPOPEN_TIMEOUT = TimeSpan.FromHours(4);
    private DateTime appOpenExpireTime;

    private AppOpenAd appOpenAd;
    private BannerView bannerView;
    private InterstitialAd interstitialAd;
    private RewardedAd rewardedAd;
    private RewardedInterstitialAd rewardedInterstitialAd;
    /*
    public UnityEvent OnAdLoadedEvent;
    public UnityEvent OnAdFailedToLoadEvent;
    public UnityEvent OnAdOpeningEvent;
    public UnityEvent OnAdFailedToShowEvent;
    public UnityEvent OnUserEarnedRewardEvent;
    public UnityEvent OnAdClosedEvent;
    */

    //Admob测试id ca-app-pub-3940256099942544~3347511713
    private const string open_android_test = "ca-app-pub-3940256099942544/3419835294";
    private const string open_ios_test = "ca-app-pub-3940256099942544/5662855259";
    private const string banner_android_test = "ca-app-pub-3940256099942544/6300978111";
    private const string banner_ios_test = "ca-app-pub-3940256099942544/2934735716";
    private const string interstitial_android_test = "ca-app-pub-3940256099942544/1033173712";
    private const string interstitial_ios_test = "ca-app-pub-3940256099942544/4411468910";
    private const string video_android_test = "ca-app-pub-3940256099942544/5224354917";
    private const string video_ios_test = "ca-app-pub-3940256099942544/1712485313";
    private const string video_interstitial_android_test = "ca-app-pub-3940256099942544/5354046379";
    private const string video_interstitial_ios_test = "ca-app-pub-3940256099942544/6978759866";

    //admob 正式id ca-app-pub-1111111111~222222222 
    private const string open_android = "";
    private const string open_ios = "";
    private const string banner_android = "";
    private const string banner_ios = "";
    private const string interstitial_android = "";
    private const string interstitial_ios = "";
    private const string video_android = "ca-app-pub-11111111/22222222";
    private const string video_ios = "";

    public Text statusText;
    public bool isTest; //是否为测试模式

    private void Start()
    {
        if (!isTest)
        {
            //广告线程与unity主线程同步
            MobileAds.RaiseAdEventsOnUnityMainThread = true;

            //添加测试机
            /*
            List<String> deviceIds = new List<String>() { AdRequest.TestDeviceSimulator };
    #if UNITY_ANDROID
            deviceIds.Add("86BF82E91DB5A2AE32FB942B2B179E9F");
    #elif UNITY_IPHONE
                MobileAds.SetiOSAppPauseOnBackground(true);
                 deviceIds.Add("");
    #endif
            RequestConfiguration requestConfiguration =
                new RequestConfiguration.Builder()
                .SetTagForChildDirectedTreatment(TagForChildDirectedTreatment.Unspecified)
                .SetTestDeviceIds(deviceIds).build();
            MobileAds.SetRequestConfiguration(requestConfiguration);
            */

            //初始化
            MobileAds.Initialize((InitializationStatus obj) =>
            {
                Debug.Log("sdk init success");

                MobileAdsEventExecutor.ExecuteInUpdate(() =>
                {
                    //LoadBanner();
                    //RequestInterstitial();
                    RequestAndLoadRewardedAd();
                    //RequestAndLoadAppOpenAd();
                });
            });

            //AppStateEventNotifier.AppStateChanged += OnAppStateChanged;
        }
    }

    private AdRequest CreateAdRequest()
    {
        return new AdRequest.Builder()
            .AddKeyword("unity-admob-game")
            .Build();
    }

    #region--------Banner Ads--------------------------------------------------
    public void RequestBannerAd()
    {
        PrintStatus("Requesting Banner ad.");
        string adUnitId;
        if (isTest)
        {
#if UNITY_EDITOR
            adUnitId = "unused";
#elif UNITY_ANDROID
        adUnitId = banner_android_test;
#elif UNITY_IPHONE
        adUnitId = banner_ios_test;
#else
        adUnitId = "unexpected_platform";
#endif
        }
        else
        {
#if UNITY_EDITOR
            adUnitId = "unused";
#elif UNITY_ANDROID
        adUnitId = banner_android;
#elif UNITY_IPHONE
        adUnitId = banner_ios;
#else
        adUnitId = "unexpected_platform";
#endif
        }

        // Clean up banner before reusing
        if (bannerView != null)
        {
            bannerView.Destroy();
        }

        // Create a 320x50 banner at top of the screen
        bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Top);

        // Add Event Handlers
        bannerView.OnBannerAdLoaded += () =>
        {
            PrintStatus("Banner ad loaded.");
            //OnAdLoadedEvent.Invoke();
        };
        bannerView.OnBannerAdLoadFailed += (LoadAdError error) =>
        {
            PrintStatus("Banner ad failed to load with error: " + error.GetMessage());
            //OnAdFailedToLoadEvent.Invoke();
        };
        bannerView.OnAdImpressionRecorded += () =>
        {
            PrintStatus("Banner ad recorded an impression.");
        };
        bannerView.OnAdClicked += () =>
        {
            PrintStatus("Banner ad recorded a click.");
        };
        bannerView.OnAdFullScreenContentOpened += () =>
        {
            PrintStatus("Banner ad opening.");
            //OnAdOpeningEvent.Invoke();
        };
        bannerView.OnAdFullScreenContentClosed += () =>
        {
            PrintStatus("Banner ad closed.");
            //OnAdClosedEvent.Invoke();
        };
        bannerView.OnAdPaid += (AdValue adValue) =>
        {
            string msg = string.Format("{0} (currency: {1}, value: {2}",
                                        "Banner ad received a paid event.",
                                        adValue.CurrencyCode,
                                        adValue.Value);
            PrintStatus(msg);
        };

        // Load a banner ad
        bannerView.LoadAd(CreateAdRequest());
    }

    public void DestroyBannerAd()
    {
        if (bannerView != null)
        {
            bannerView.Destroy();
        }
    }
    #endregion

    #region --------Interstitial Ads--------------------------------------------
    public void RequestAndLoadInterstitialAd()
    {
        PrintStatus("Requesting Interstitial ad.");
        string adUnitId;
        if (isTest)
        {
#if UNITY_EDITOR
            adUnitId = "unused";
#elif UNITY_ANDROID
        adUnitId = interstitial_android_test;
#elif UNITY_IPHONE
        adUnitId = interstitial_ios_test;
#else
        adUnitId = "unexpected_platform";
#endif
        }
        else
        {
#if UNITY_EDITOR
            adUnitId = "unused";
#elif UNITY_ANDROID
        adUnitId = interstitial_android;
#elif UNITY_IPHONE
        adUnitId = interstitial_ios;
#else
        adUnitId = "unexpected_platform";
#endif
        }

        // Clean up interstitial before using it
        if (interstitialAd != null)
        {
            interstitialAd.Destroy();
        }

        // Load an interstitial ad
        InterstitialAd.Load(adUnitId, CreateAdRequest(),
            (InterstitialAd ad, LoadAdError loadError) =>
            {
                if (loadError != null)
                {
                    PrintStatus("Interstitial ad failed to load with error: " +
                        loadError.GetMessage());
                    return;
                }
                else if (ad == null)
                {
                    PrintStatus("Interstitial ad failed to load.");
                    return;
                }

                PrintStatus("Interstitial ad loaded.");
                interstitialAd = ad;

                ad.OnAdFullScreenContentOpened += () =>
                {
                    PrintStatus("Interstitial ad opening.");
                    //OnAdOpeningEvent.Invoke();
                };
                ad.OnAdFullScreenContentClosed += () =>
                {
                    PrintStatus("Interstitial ad closed.");
                    //OnAdClosedEvent.Invoke();
                };
                ad.OnAdImpressionRecorded += () =>
                {
                    PrintStatus("Interstitial ad recorded an impression.");
                };
                ad.OnAdClicked += () =>
                {
                    PrintStatus("Interstitial ad recorded a click.");
                };
                ad.OnAdFullScreenContentFailed += (AdError error) =>
                {
                    PrintStatus("Interstitial ad failed to show with error: " +
                                error.GetMessage());
                };
                ad.OnAdPaid += (AdValue adValue) =>
                {
                    string msg = string.Format("{0} (currency: {1}, value: {2}",
                                               "Interstitial ad received a paid event.",
                                               adValue.CurrencyCode,
                                               adValue.Value);
                    PrintStatus(msg);
                };
            });
    }

    public void ShowInterstitialAd()
    {
        if (interstitialAd != null && interstitialAd.CanShowAd())
        {
            interstitialAd.Show();
        }
        else
        {
            PrintStatus("Interstitial ad is not ready yet.");
        }
    }

    public void DestroyInterstitialAd()
    {
        if (interstitialAd != null)
        {
            interstitialAd.Destroy();
        }
    }
    #endregion

    #region --------open Ads----------------------------------------------------
    public bool IsAppOpenAdAvailable
    {
        get
        {
            return (appOpenAd != null && appOpenAd.CanShowAd() && DateTime.Now < appOpenExpireTime);
        }
    }

    public void OnAppStateChanged(AppState state)
    {
        Debug.Log("App State is " + state);
        MobileAdsEventExecutor.ExecuteInUpdate(() =>
        {
            if (state == AppState.Foreground)
            {
                ShowAppOpenAd();
            }
        });
    }

    public void RequestAndLoadAppOpenAd()
    {
        PrintStatus("Requesting App Open ad.");
        string adUnitId;
        if (isTest)
        {
#if UNITY_EDITOR
            adUnitId = "unused";
#elif UNITY_ANDROID
        adUnitId = open_android_test;
#elif UNITY_IPHONE
        adUnitId = open_ios_test;
#else
        adUnitId = "unexpected_platform";
#endif
        }
        else
        {
#if UNITY_EDITOR
            adUnitId = "unused";
#elif UNITY_ANDROID
        adUnitId = open_android;
#elif UNITY_IPHONE
        adUnitId = open_ios;
#else
        adUnitId = "unexpected_platform";
#endif
        }
        // destroy old instance.
        if (appOpenAd != null)
        {
            DestroyAppOpenAd();
        }

        // Create a new app open ad instance.
        AppOpenAd.Load(adUnitId, ScreenOrientation.Portrait, CreateAdRequest(),
            (AppOpenAd ad, LoadAdError loadError) =>
            {
                if (loadError != null)
                {
                    PrintStatus("App open ad failed to load with error: " +
                        loadError.GetMessage());
                    return;
                }
                else if (ad == null)
                {
                    PrintStatus("App open ad failed to load.");
                    return;
                }

                PrintStatus("App Open ad loaded. Please background the app and return.");
                this.appOpenAd = ad;
                this.appOpenExpireTime = DateTime.Now + APPOPEN_TIMEOUT;

                ad.OnAdFullScreenContentOpened += () =>
                {
                    PrintStatus("App open ad opened.");
                    //OnAdOpeningEvent.Invoke();
                };
                ad.OnAdFullScreenContentClosed += () =>
                {
                    PrintStatus("App open ad closed.");
                    //OnAdClosedEvent.Invoke();
                };
                ad.OnAdImpressionRecorded += () =>
                {
                    PrintStatus("App open ad recorded an impression.");
                };
                ad.OnAdClicked += () =>
                {
                    PrintStatus("App open ad recorded a click.");
                };
                ad.OnAdFullScreenContentFailed += (AdError error) =>
                {
                    PrintStatus("App open ad failed to show with error: " +
                        error.GetMessage());
                };
                ad.OnAdPaid += (AdValue adValue) =>
                {
                    string msg = string.Format("{0} (currency: {1}, value: {2}",
                                               "App open ad received a paid event.",
                                               adValue.CurrencyCode,
                                               adValue.Value);
                    PrintStatus(msg);
                };
            });
    }

    public void DestroyAppOpenAd()
    {
        if (this.appOpenAd != null)
        {
            this.appOpenAd.Destroy();
            this.appOpenAd = null;
        }
    }

    public void ShowAppOpenAd()
    {
        if (!IsAppOpenAdAvailable)
        {
            return;
        }
        appOpenAd.Show();
    }
    #endregion

    #region--------reward Ads--------------------------------------------------
    public void RequestAndLoadRewardedAd()
    {
        string adUnitId;
        PrintStatus("Requesting Rewarded ad.");
        if (isTest)
        {
#if UNITY_EDITOR
            adUnitId = "unused";
#elif UNITY_ANDROID
        adUnitId = video_android_test;
#elif UNITY_IPHONE
        adUnitId = video_ios_test;
#else
        adUnitId = "unexpected_platform";
#endif
        }
        else
        {
#if UNITY_EDITOR
            adUnitId = "unused";
#elif UNITY_ANDROID
        adUnitId = video_android;
#elif UNITY_IPHONE
        adUnitId = video_ios;
#else
        adUnitId = "unexpected_platform";
#endif
        }

        // create new rewarded ad instance
        RewardedAd.Load(adUnitId, CreateAdRequest(),
            (RewardedAd ad, LoadAdError loadError) =>
            {
                if (loadError != null)
                {
                    PrintStatus("Rewarded ad failed to load with error: " +
                                loadError.GetMessage());
                    return;
                }
                else if (ad == null)
                {
                    PrintStatus("Rewarded ad failed to load.");
                    return;
                }

                PrintStatus("Rewarded ad loaded.");
                rewardedAd = ad;

                ad.OnAdFullScreenContentOpened += () =>
                {
                    PrintStatus("Rewarded ad opening.");
                    //OnAdOpeningEvent.Invoke();
                };
                ad.OnAdFullScreenContentClosed += () =>
                {
                    PrintStatus("Rewarded ad closed.");
                    //OnAdClosedEvent.Invoke();
                };
                ad.OnAdImpressionRecorded += () =>
                {
                    PrintStatus("Rewarded ad recorded an impression.");
                };
                ad.OnAdClicked += () =>
                {
                    PrintStatus("Rewarded ad recorded a click.");
                };
                ad.OnAdFullScreenContentFailed += (AdError error) =>
                {
                    PrintStatus("Rewarded ad failed to show with error: " +
                               error.GetMessage());
                };
                ad.OnAdPaid += (AdValue adValue) =>
                {
                    string msg = string.Format("{0} (currency: {1}, value: {2}",
                                               "Rewarded ad received a paid event.",
                                               adValue.CurrencyCode,
                                               adValue.Value);
                    PrintStatus(msg);
                };
            });
    }

    public void ShowRewardedAd(Action act)
    {
        if (isTest)
        {
            act();
        }
        else
        {
            if (rewardedAd != null)
            {
                rewardedAd.Show((Reward reward) =>
                {
                    act();
                    PrintStatus("Rewarded ad granted a reward: " + reward.Amount);
                    RequestAndLoadRewardedAd();
                });
            }
            else
            {
                PrintStatus("Rewarded ad is not ready yet.");
                RequestAndLoadRewardedAd();
            }
        }
    }
    #endregion

    #region--------reward Interstitial Ads-------------------------------------
    public void RequestAndLoadRewardedInterstitialAd()
    {
        PrintStatus("Requesting Rewarded Interstitial ad.");
#if UNITY_EDITOR
        string adUnitId = "unused";
#elif UNITY_ANDROID
            string adUnitId = video_interstitial_android_test;
#elif UNITY_IPHONE
            string adUnitId = video_interstitial_ios_test;
#else
            string adUnitId = "unexpected_platform";
#endif

        // Create a rewarded interstitial.
        RewardedInterstitialAd.Load(adUnitId, CreateAdRequest(),
            (RewardedInterstitialAd ad, LoadAdError loadError) =>
            {
                if (loadError != null)
                {
                    PrintStatus("Rewarded interstitial ad failed to load with error: " +
                                loadError.GetMessage());
                    return;
                }
                else if (ad == null)
                {
                    PrintStatus("Rewarded interstitial ad failed to load.");
                    return;
                }

                PrintStatus("Rewarded interstitial ad loaded.");
                rewardedInterstitialAd = ad;

                ad.OnAdFullScreenContentOpened += () =>
                {
                    PrintStatus("Rewarded interstitial ad opening.");
                    //OnAdOpeningEvent.Invoke();
                };
                ad.OnAdFullScreenContentClosed += () =>
                {
                    PrintStatus("Rewarded interstitial ad closed.");
                    //OnAdClosedEvent.Invoke();
                };
                ad.OnAdImpressionRecorded += () =>
                {
                    PrintStatus("Rewarded interstitial ad recorded an impression.");
                };
                ad.OnAdClicked += () =>
                {
                    PrintStatus("Rewarded interstitial ad recorded a click.");
                };
                ad.OnAdFullScreenContentFailed += (AdError error) =>
                {
                    PrintStatus("Rewarded interstitial ad failed to show with error: " +
                                error.GetMessage());
                };
                ad.OnAdPaid += (AdValue adValue) =>
                {
                    string msg = string.Format("{0} (currency: {1}, value: {2}",
                                                "Rewarded interstitial ad received a paid event.",
                                                adValue.CurrencyCode,
                                                adValue.Value);
                    PrintStatus(msg);
                };
            });
    }

    public void ShowRewardedInterstitialAd()
    {
        if (rewardedInterstitialAd != null)
        {
            rewardedInterstitialAd.Show((Reward reward) =>
            {
                PrintStatus("Rewarded interstitial granded a reward: " + reward.Amount);
            });
        }
        else
        {
            PrintStatus("Rewarded interstitial ad is not ready yet.");
        }
    }
    #endregion
    ///<summary>
    /// Log the message and update the status text on the main thread.
    ///<summary>
    private void PrintStatus(string message)
    {
        if (isTest)
        {
            Debug.Log(message);
            MobileAdsEventExecutor.ExecuteInUpdate(() =>
            {
                statusText.text = message;
            });
        }
    }
}

9.gradle 配置

allprojects {
    repositories {
        maven { url 'https://dl.google.com/dl/android/maven2/' }
        google()
        maven { url "https://jitpack.io" }
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        jcenter()
       
        flatDir {
            dirs 'libs'
        }
        mavenLocal()
        maven {
            url "https://maven.aliyun.com/nexus/content/repositories/releases"
        }

    }
}



10. gradle 下载地址

unity 升级gradle版本文章来源地址https://www.toymoban.com/news/detail-407779.html

到了这里,关于unity---接入Admob的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • PowerBi连接MySQL提示需安装组件才能使用,本人删去已经下载好的组件,再做一份详细教程。

    当我们用PowerBi连接Mysql时候,他突然提示我们需要安装组件。 检查自己的MySQL版本 打开cmd运行框,输入命令 mysql -uroot -p ,再输入数据库密码 输入 select version(); 我这里是8.0.16版本,记住自己的版本号 下载 mysql connector https://downloads.mysql.com/archives/c-net/ 选择自己对于的版本号下载

    2024年02月05日
    浏览(46)
  • 华为交换机配置mac地址白名单接入

    华为核心交换机配置mac地址白名单接入 华为核心交换机配置mac地址白名单,仅允许白名单内的终端接入指定的vlan。 例如: 仅允许mac地址为: 4557-ca30-75a1 的电脑接入 vlan 101. 登录核心交换机,找到该电脑对应的mac地址:  或者在电脑的cmd输入 ipconfig /all 检查mac地址: 配置白

    2024年02月04日
    浏览(51)
  • ONNX:C++通过onnxruntime使用.onnx模型进行前向计算【下载的onnxruntime是编译好的库文件,可直接使用】

    微软联合Facebook等在2017年搞了个深度学习以及机器学习模型的格式标准–ONNX,旨在将所有模型格式统一为一致,更方便地实现模型部署。现在大多数的深度学习框架都支持ONNX模型转出并提供相应的导出接口。 ONNXRuntime(Open Neural Network Exchange)是微软推出的一款针对ONNX模型格式

    2024年02月15日
    浏览(49)
  • 华为 huawei 交换机 接口 MAC 地址学习限制接入用户数量 配置示例

    目录 组网需求: 配置思路: 操作步骤: 配置文件: 如 图 2-14 所示,用户网络 1 和用户网络 2 通过 LSW 与 Switch 相连, Switch 连接 LSW 的接口为GE0/0/1 。用户网络 1 和用户网络 2 分别属于 VLAN10 和 VLAN20 。在 Switch 上,为了控制接入用户数量,可以基于接口GE0/0/1 配置 MAC 地址学习

    2024年02月20日
    浏览(46)
  • 【unity接入SDK案例】从0到1 如何接入百度地图SDK到unity中【一】

    👨‍💻个人主页 :@元宇宙-秩沅 👨‍💻 hallo 欢迎 点赞👍 收藏⭐ 留言📝 加关注✅! 👨‍💻 本文由 秩沅 原创 👨‍💻 收录于专栏 :Unity基础实战 下载入口 下载入口 android studio版本是:2021.2.1.16, 打开后 点击SDK Manager 我们需要更改一下SDK的安装路径 选择自己新建的文

    2024年03月17日
    浏览(46)
  • 【unity接入SDK案例】从0到1 如何接入百度地图SDK到unity中【二】

    👨‍💻个人主页 :@元宇宙-秩沅 👨‍💻 hallo 欢迎 点赞👍 收藏⭐ 留言📝 加关注✅! 👨‍💻 本文由 秩沅 原创 👨‍💻 收录于专栏 :Unity基础实战 下载入口 下载入口 android studio版本是:2021.2.1.16, 打开后 点击SDK Manager 我们需要更改一下SDK的安装路径 选择自己新建的文

    2024年04月09日
    浏览(49)
  • 【第三方SDK接入汇总】Unity接入VuforiaAR(图片识别)

    目录 一.注册Vuforia账号 二.获取许可秘钥 三.获取Vuforia的SDK导入unity 四.搭建创建AR场景 五.打包到手机 注册地址:Engine Developer Portal 申请地址:https://developer.vuforia.com/vui/develop/licenses 方式一: 官网下载 下载地址:SDK Download | Engine Developer Portal  下载后把package包导入unity即可。

    2024年04月08日
    浏览(53)
  • [Unity]关于Unity接入Appsflyer并且打点支付

    首先需要去官方下载Appsflyer的UnityPackage 链接在这afPackage 然后导入 导入完成 引入此段代码 然后把他挂在到一个有DontDestroyOnLoad(this)的物体上 没有的话就自己在awake里面加一个 接下来需要引入 这个物体 Key Id和上面一样 然后下面就是埋点支付的教程了 在In app 的这个方法里 添

    2024年01月18日
    浏览(53)
  • Unity接入PICO Unity Integration SDK

     1.我下载的SD版本是 2.2;  2.支持Pico3 ,Pico 4开发   3.Pico设备的系统版本要在5.6.0以上 4.注意支持的Unity 版本最低为2020.3.21  我用的是2021.2.5 下载完成并且解压出来  1.打开包管理器,选择从磁盘中加载选择 packakge.json  回到unity后会看见是否切换新版输入系统,然后等待unity重启

    2024年02月07日
    浏览(46)
  • Unity 接入监控视频

    海康 rtsp://[username]:[password]@[ip]:[port]/[codec]/[channel]/[subtype]/av_stream 详解: username: 用户名。例如admin。 password: 密码。例如12345。 ip: 为设备IP。例如 192.0.0.64。 port: 端口号默认为554,若为默认可不填写。 codec:有h264、MPEG-4、mpeg4这几种。 channel: 通道号,起始为1。例如通道1,则

    2024年02月03日
    浏览(33)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包