找回密码
 立即注册
搜索

[编辑器/功能拓展] 2D WebView for WebGL (Web Browser IFrame) 4.1

[复制链接]
114 |0
发表于 2023-7-7 14:04:59 | 显示全部楼层 |阅读模式












Easily display and interact with web content in 2D using the web browser plugin trusted by hundreds of developers. Try the demo here and see the developer site for full documentation.

Due to browser limitations, this package has significant limitations compared to the other 3D WebView packages. Please see this page for the full list of limitations.

• C# source code for a unified API that works seamlessly across Android, iOS, Windows, macOS, WebGL, and UWP / Hololens (each platform sold separately)
• Powered by the HTML <iframe> element
• Comprehensive APIs for controlling the browser and listening to browser events (see this page for limitations)
• Execute JavaScript
• Send messages from JavaScript to C# and vice versa
• View PDFs
• Integrate with OAuth
• Includes additional APIs for platform-specific features
• Supports transparent pages

Examples
• 3D WebView's included CanvasWebViewDemo scene
• WebGL WebView Demo

System requirements
• Unity 2018.4 or newer
• WebGL Build Support
• Adds < 50 KB to the app's size

Important notes and limitations
• This package only supports WebGL. To support other platforms, you can install additional 3D WebView packages, and you can save money on multiple packages by buying a bundle. All of the 3D WebView packages work seamlessly together, so all you need to do is install them into the same project, and then 3D WebView automatically detects and uses the correct plugin at runtime and build time.
• 3D WebView's native WebGL plugins are provided as precompiled libraries, and the native source code for them is not provided.
• 3D WebView's WebGL plugins can't run in the editor, so a mock webview implementation is used by default while running in the editor. However, you can actually load and render real web content in the editor by also installing 3D WebView for Windows and macOS into the project. You can save money by buying both packages together in a bundle.
• This package only supports Native 2D Mode, so the 2D CanvasWebViewPrefab works, but the 3D WebViewPrefab does not. Also, it's not possible to place other Unity objects or UI elements in front of a webview. You can read more about this limitation here.
• This package is unable to load websites that block iframes by sending an X-Frame-Options header. For example, many popular sites like Google and Facebook block iframes using X-Frame-Options. You can read more about this limitation and test if a URL is compatible here.
• When the webview's URL has a different domain than the Unity app, most of the IWebView methods become disabled. You can read more about this limitation here. HTML loaded with LoadHtml() also faces this limitation, but an alternative that supports the IWebView methods is to load the HTML from StreamingAssets instead.


使用数百名开发人员信任的web浏览器插件轻松显示和交互2D web内容。请尝试此处的演示,并查看开发人员站点以获取完整文档。

由于浏览器的限制,与其他3D WebView包相比,这个包有很大的局限性。有关限制的完整列表,请参阅本页。

•统一API的c#源代码,可在Android、iOS、Windows、macOS、WebGL和UWP / Hololens(每个平台单独销售)之间无缝工作。
•由HTML <iframe>元素提供支持
•用于控制浏览器和监听浏览器事件的综合api(参见本页的限制)
•执行JavaScript
•从JavaScript发送消息到c#,反之亦然
•查看pdf文件
•与OAuth集成
•包含针对平台特定功能的额外api
•支持透明页面

例子
•3D WebView包含CanvasWebViewDemo场景
•WebGL WebView演示

系统需求
•Unity 2018.4或更新版本
•WebGL构建支持
•添加< 50 KB的应用程序的大小

重要注意事项和限制
•这个包只支持WebGL。为了支持其他平台,您可以安装额外的3D WebView软件包,并且可以通过购买捆绑包来节省多个软件包的费用。所有的3D WebView包都可以无缝地一起工作,所以你所需要做的就是将它们安装到同一个项目中,然后3D WebView会在运行时和构建时自动检测并使用正确的插件。
•3D WebView的原生WebGL插件以预编译库的形式提供,不提供原生源代码。
•3D WebView的WebGL插件不能在编辑器中运行,因此在编辑器中运行时默认使用模拟WebView实现。然而,你可以在编辑器中加载和渲染真实的网页内容,也可以在项目中安装Windows和macOS的3D WebView。你可以通过同时购买两个包来省钱。
•这个包只支持原生2D模式,所以2D CanvasWebViewPrefab工作,但3D WebViewPrefab不。此外,不可能在webview前面放置其他Unity对象或UI元素。您可以在这里阅读有关此限制的更多信息。
•这个包是无法加载的网站,阻止发送一个x帧选项头。例如,许多流行的网站,如Google和Facebook,都使用X-Frame-Options来阻止iframe。您可以在这里阅读有关此限制的更多信息,并测试URL是否兼容。
•当webview的URL与Unity应用程序的域名不同时,大多数IWebView方法将被禁用。您可以在这里阅读有关此限制的更多信息。用LoadHtml()加载的HTML也面临这个限制,但是另一种支持IWebView方法的方法是从StreamingAssets加载HTML。





回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表