Coder Social home page Coder Social logo

ly774508966 / unity-webview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gree/unity-webview

0.0 2.0 0.0 2.6 MB

License: zlib License

HTML 9.21% JavaScript 8.66% C# 27.82% Ruby 3.50% Shell 0.88% Java 13.31% Objective-C 20.77% Objective-C++ 15.85%

unity-webview's Introduction

unity-webview

unity-webview is a plugin for Unity 5 that overlays WebView components on Unity view. It works on Android, iOS, Unity Web Player, and OS X (Windows is not supported for now).

unity-webview is derived from keijiro-san's https://github.com/keijiro/unity-webview-integration .

Sample Project

It is placed under sample/. You can open it and import the plugin as below:

  1. Open sample/Assets/Sample.unity.
  2. Open dist/unity-webview.unitypackage and import all files. It might be easier to extract dist/unity-webview.zip instead if you've imported unity-webview before.

Platform Specific Notes

OS X (Editor)

Since Unity 5.3.0, Unity.app is built with ATS (App Transport Security) enabled and non-secured connection (HTTP) is not permitted. If you want to open http://foo/bar.html with this plugin on Unity OS X Editor, you need to open /Applications/Unity5.3.4p3/Unity.app/Contents/Info.plist with a text editor and add the following,

--- Info.plist~	2016-04-11 18:29:25.000000000 +0900
+++ Info.plist	2016-04-15 16:17:28.000000000 +0900
@@ -57,5 +57,10 @@
 	<string>EditorApplicationPrincipalClass</string>
 	<key>UnityBuildNumber</key>
 	<string>b902ad490cea</string>
+	<key>NSAppTransportSecurity</key>
+	<dict>
+		<key>NSAllowsArbitraryLoads</key>
+		<true/>
+	</dict>
 </dict>
 </plist>

or invoke the following from your terminal,

/usr/libexec/PlistBuddy -c "Add NSAppTransportSecurity:NSAllowsArbitraryLoads bool true" /Applications/Unity/Unity.app/Contents/Info.plist

References

iOS

The implementation now supports WKWebView but it is disabled by default. For enabling it, please set enableWKWebView as below:

		webViewObject.Init(
            ...
            enableWKWebView: true);

Android

Once you built an apk, please copy sample/Temp/StatingArea/AndroidManifest-main.xml to sample/Assets/Plugins/Android/AndroidManifest.xml, edit the latter to add android:hardwareAccelerated="true" to <activity android:name="com.unity3d.player.UnityPlayerActivity" ..., and rebuilt the apk. Although some old/buggy devices may not work well with android:hardwareAccelerated="true", the WebView runs very smoothly with this setting.

Web Player

The implementation utilizes IFRAME so please put both "an_unityplayer_page.html" and "a_page_loaded_in_webview.html" should be placed on the same domain for avoiding cross-domain requests.

unity-webview's People

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.