当前位置:   article > 正文

unity可以直接转h5吗_unity 内嵌h5页面跳转原生app

unity2d 怎么弄h5地址

unity 内嵌H5界面需要用到Uniwebview 差件,百度搜索下就可以找到插件下载地址,这里就不提供了

Uniwebview 支持Android 、IOS。  PC平台下不显示,需要打包测试。

下面是封装好的动态加载外部网页类

using System;

using UnityEngine;

public class WebView : Singleton {

public delegate void WebOnReceivedMessage(UniWebView webView, UniWebViewMessage message);

public WebOnReceivedMessage OnWebReceivedMessage;

#if !(UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN)

private UniWebView webView;

#endif

private Action onClose;

private void CreateWebView(Rect panelPosition,Action loadFinished = null) {

#if !(UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN)

if (this.webView == null) {

this.webView = this.gameObject.AddComponent();

}

int top, left, bottom, right;

#if UNITY_ANDROID

left = (int)panelPosition.x;

top = (int)panelPosition.y;

bottom = (int)(Screen.height - panelPosition.height - top);

right = (int)(Screen.width - panelPosition.width - left) ;

#endif

#if UNITY_IOS

float ratio;

ratio = 1f / UniWebViewHelper.screenScale;

left = (int)(panelPosition.x * ratio);

top = (int)(

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/112643?site
推荐阅读
相关标签
  

闽ICP备14008679号