All Projects → tunerok → Unity_browser

tunerok / Unity_browser

Licence: gpl-3.0
Open source Unity3d web browser created by Vitaly Chashin https://bitbucket.org/vitaly_chashin/simpleunitybrowser

Projects that are alternatives of or similar to Unity browser

Azure Sdk For Js
This repository is for active development of the Azure SDK for JavaScript (NodeJS & Browser). For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/en-us/javascript/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-js.
Stars: ✭ 872 (+2712.9%)
Mutual labels:  browser
Unityfx
DocFX template to create Unity-esque documentation
Stars: ✭ 21 (-32.26%)
Mutual labels:  unity3d
Navalia
A bullet-proof, fast, and reliable headless browser API
Stars: ✭ 950 (+2964.52%)
Mutual labels:  browser
Brave Ios
Brave iOS Browser
Stars: ✭ 871 (+2709.68%)
Mutual labels:  browser
Awesome Mad Science
Delightful npm packages that make you say "wow, didn't know that was possible!"
Stars: ✭ 909 (+2832.26%)
Mutual labels:  browser
Postprocessingdemo
A demo project used in the post-processing stack presentation at Unite 2017 Tokyo.
Stars: ✭ 21 (-32.26%)
Mutual labels:  unity3d
Shadergraphexamples
Simple examples of Unity shader graphs.
Stars: ✭ 869 (+2703.23%)
Mutual labels:  unity3d
Museum
Live coding rig for Channel 18 at SuperDeluxe
Stars: ✭ 30 (-3.23%)
Mutual labels:  unity3d
Pix2pix
Real-time pix2pix implementation with Unity
Stars: ✭ 912 (+2841.94%)
Mutual labels:  unity3d
Unitystationbumper
Video bumper for Unity's live streaming channel.
Stars: ✭ 28 (-9.68%)
Mutual labels:  unity3d
Beaverandfairies
Stars: ✭ 14 (-54.84%)
Mutual labels:  unity3d
Hat.sh
encrypt and decrypt files in your browser. Fast, Secure client-side File Encryption and Decryption using the web crypto api
Stars: ✭ 886 (+2758.06%)
Mutual labels:  browser
Univrm
Unity package that can import and export VRM format
Stars: ✭ 914 (+2848.39%)
Mutual labels:  unity3d
Moverbots
A small Unity AI game built with ML-agents v0.5
Stars: ✭ 13 (-58.06%)
Mutual labels:  unity3d
Regexanalyzer
Regular Expression Analyzer and Composer for Node.js / XPCOM / Browser Javascript, PHP, Python
Stars: ✭ 29 (-6.45%)
Mutual labels:  browser
C Sharp Promise
Promises library for C# for management of asynchronous operations.
Stars: ✭ 870 (+2706.45%)
Mutual labels:  unity3d
Hsplugins
Various Honey Select plugins
Stars: ✭ 21 (-32.26%)
Mutual labels:  unity3d
Savegamepro
A Complete and Powerful Save Game Solution for Unity (Game Engine)
Stars: ✭ 30 (-3.23%)
Mutual labels:  unity3d
Browser Ios
Brave iOS Browser
Stars: ✭ 955 (+2980.65%)
Mutual labels:  browser
Vdjviz
A lightweight immune repertoire browser
Stars: ✭ 21 (-32.26%)
Mutual labels:  browser

unity_browser

Open source Unity3d web browser created by Vitaly Chashin https://bitbucket.org/vitaly_chashin/simpleunitybrowser and fixed buld crashes by Stulov Dmitry https://bitbucket.org/ShadowTeolog/simpleunitybrowser.

Basic setup

Import the package to Unity or just open test.unity file. There will be a few folders in Assets/SimpleWebBrowser. You can move/rename all of them, but in case of Assets/SimpleWebBrowser/PluginServer you will need to change the runtime and deployment paths in Scripts/BrowserEngine.cs and in Editor/BrowserPostBuild.cs:

 public void InitPlugin(int width, int height, string sharedfilename, int port, string initialURL)
        {

            //Initialization (for now) requires a predefined path to PluginServer,
            //so change this section if you move the folder
            //Also change the path in deployment script.

#if UNITY_EDITOR_64
            string PluginServerPath = Application.dataPath + @"\SimpleWebBrowser\PluginServer\x64";
#else
#if UNITY_EDITOR_32
        string PluginServerPath = Application.dataPath + @"\SimpleWebBrowser\PluginServer\x86";

The package contains two demo scenes, for the inworld and canvas browser; you can use them as a reference, or just drag one of the prefabs to the scene.

Settings

browser_settings

  • Width and height - width and height of the browser texture.
  • Memory file and Port - in general, you can keep them random. Memory file is the name of a shared memory file, which is used to send the texture data, and port is a TCP port for the communication between browser and plugin. In case of random, memory file will be a random GUID, and a port will be between 8000 and 9000. But you can set them manually, if you want.
  • Initial URL - obviously, the initial browser URL.
  • WebRTC - enable/disable WebRTC support.
  • UI settings - settings for the main browser controls. You can customize them the way you like, changing they appearance in editor and behaviour in BrowserUI.cs.
  • Dialog settings - same as UI, but for modal dialogs.
  • 2D browser setup is almost the same, except the Browser2D raw image texture setting, which is the base texture for browser.

Deployment

The plugin works for Win32/64, both in editor and in app. The post-build step is automated, it creates a folder named PluginServer in your output folder. You can change this, for example, put the PluginServer into the Data folder, but in such case you need to change the deployment paths (see Basic Setup).

JavaScript integration

Currently you can execute any JS code in the browser window by calling WebBrowser.RunJavaScript(string js) and send the message from the web page (see Demo/SampleJSQueryHandler.cs). On JavaScript side, you need code like this:

// Send a query to the browser process.
function sendMessage() {
  window.cefQuery({
    request: 'BindingTest:' + document.getElementById("message").value,
    onSuccess: function(response) {
      document.getElementById('result').value = 'Response: '+response;
    },
    onFailure: function(error_code, error_message) {}
  });
}

See BindingTest.html for an example.

Building the PluginServer from the repository

You can build the plugin server from scratch, for example, if you want to change something in communication or page rendering.

Folder structure:

  • MessageLibrary - an implementation of communication protocol
  • packages - nuget folder
  • SharedPluginServer - the main project
  • TestClient - WinForms client for tests. Warning - the code is not cleaned up, not commented, etc.
  • third_party - prebuilt libraries used in project
    • cef_64 - CEF x64 runtime
    • cef_86 - CEF x86 runtime
    • SharedMemory_86 - SharedMemory.dll for x86 builds
    • SharedMemory_86_Unity - SharedMemory.dll for Unity x86
    • SharedMemory_Unity - SharedMemory for Unity x64
    • log4net.dll
    • SharedMemory.dll - the base x64 SharedMemory realization
    • Xilium.CefGlue.dll
  • UnityClient - the main Unity project.

Building the main solution

In general, just build it. By default it set to Debug/x64; in case of building it for x86, you need to remove the references to third_party\SharedMemory.dll from SharedPluginServer and TestClient, and add the references to third_party\SharedMemory_86\SharedMemory.dll.

Testing and debugging

Set the TestClient as the startup project. Change the path to SharedPluginServer in Form1.cs:

Process pluginProcess = new Process()
            {
                StartInfo = new ProcessStartInfo()
                {
                    WorkingDirectory =
                        //  @"D:\work\unity\StandaloneConnector\SharedPluginServerClean\UnityClient\Output\x86\PluginServer",
                        @"D:\work\unity\StandaloneConnector\SimpleUnityBrowser\SharedPluginServer\bin\x64\Debug",
                    FileName =
                     //@"D:\work\unity\StandaloneConnector\SharedPluginServerClean\UnityClient\Output\x86\PluginServer\SharedPluginServer.exe",
                        @"D:\work\unity\StandaloneConnector\SimpleUnityBrowser\SharedPluginServer\bin\x64\Debug\SharedPluginServer.exe",
                    Arguments = args

                }
            };

Copy the CEF runtime from the appropriate folder in third_party to the SharedPluginServer output folder, and run the TestClient. It may crash for the first time (when Windows asks for network access), but after that it should work fine.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].