Giter Club home page Giter Club logo

unityjs's Introduction

UnityJS

UnityJS is a plugin for Unity 5 that integrates JavaScript and web browser components into Unity, including a JSON messaging system and a C# bridge, using JSON.net.

It works on WebGL, Android, iOS, macOS, and Windows [TODO].

UnityJS is derived from gree's unity-webview https://github.com/gree/unity-webview

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/UnityJS.unitypackage and import all files. It might be easier to extract dist/UnityJS.zip instead if you've imported UnityJS before.

Platform Specific Notes

macOS (Editor)

With the new Unity Hub, you can have several versions of Unity installed. But the project configuration expects the Unity app to be in /Applications/Unity/Unity.app . In order to link to the Unity libraries, you should make a symlink to the one you want, like:

ln -s /Applications/Unity/Hub/Editor/2018.3.4f1/Unity.app /Applications/Unity/Unity.app

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

Android

macOS

Windows

Building

The "build" directory contains a rake script to build the code, and a Unity project to create "dist/UnityJS.unitypackage" and "dist/UnityJS.zip".

rake
rake pack

The sample project has symbolic links into the source code and built libraries, so you can use it to develop and debug the library without reinstalling the unity package after every change. Do not attempt to install the UnityJS.unitypackage into the sample project, since that will stomp on those links and might write over the source code.

unityjs's People

Contributors

dependabot[bot] avatar simhacker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

unityjs's Issues

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.