All Projects → willnode → Webviewhook

willnode / Webviewhook

Licence: mit
Exposed Unity Editor WebView API

Projects that are alternatives of or similar to Webviewhook

Tracerysharp
C#/Unity port of Tracery (heavily WIP)
Stars: ✭ 19 (-82.24%)
Mutual labels:  unity, unity-editor
Resharper Unity
Unity support for both ReSharper and Rider
Stars: ✭ 953 (+790.65%)
Mutual labels:  unity, unity-editor
Node Level Editor
Unity3d Editor tools to create rooms quickly.
Stars: ✭ 26 (-75.7%)
Mutual labels:  unity, unity-editor
Nodegraphprocessor
Node graph editor framework focused on data processing using Unity UIElements and C# 4.6
Stars: ✭ 655 (+512.15%)
Mutual labels:  unity, unity-editor
Chromium Unity Server
Embedded web browser for Unity games, based on Chromium Embedded Framework (CEF)
Stars: ✭ 58 (-45.79%)
Mutual labels:  unity, cef
Cef2go
Go lang bindings for the Chromium Embedded Framework (CEF)
Stars: ✭ 780 (+628.97%)
Mutual labels:  cef, chrome
Unitynativescripting
Unity Scripting in C++
Stars: ✭ 844 (+688.79%)
Mutual labels:  unity, unity-editor
Phpdesktop
Developing Desktop Applications Like Developing Websites => phpdesktop
Stars: ✭ 434 (+305.61%)
Mutual labels:  cef, chrome
Uniuguitoolbar
【Unity】uGUI のオブジェクトを作成できるツールバーのエディタ拡張
Stars: ✭ 44 (-58.88%)
Mutual labels:  unity, unity-editor
Scene View Bookmarks
Unity editor extension to bookmark scene views.
Stars: ✭ 40 (-62.62%)
Mutual labels:  unity, unity-editor
Ugui Editor
Unity UGUI editor tools,improve the efficiency of ui development.
Stars: ✭ 479 (+347.66%)
Mutual labels:  unity, unity-editor
Extosc
extOSC is a tool dedicated to simplify creation of applications in Unity with OSC protocol usage.
Stars: ✭ 69 (-35.51%)
Mutual labels:  unity, unity-editor
Unitydarkskin
Switcher of UI theme in Unity Editor (light -> dark) (.NET, WPF)
Stars: ✭ 466 (+335.51%)
Mutual labels:  unity, unity-editor
Editorxr
Author XR in XR
Stars: ✭ 790 (+638.32%)
Mutual labels:  unity, unity-editor
Actors.unity
🚀Actors is a framework empowering developers to make better games faster on Unity.
Stars: ✭ 437 (+308.41%)
Mutual labels:  unity, unity-editor
Autolod
Automatic LOD generation + scene optimization
Stars: ✭ 939 (+777.57%)
Mutual labels:  unity, unity-editor
Texture maker
A texture maker tool for unity.
Stars: ✭ 358 (+234.58%)
Mutual labels:  unity, unity-editor
Easybuttons
Add buttons to your inspector in Unity super easily with this simple attribute
Stars: ✭ 410 (+283.18%)
Mutual labels:  unity, unity-editor
Unity Assetpipeline Presentation
Unity project for "A Technical Deep-Dive into Unity's Asset Pipeline" presented at Develop: 2018
Stars: ✭ 31 (-71.03%)
Mutual labels:  unity, unity-editor
Awesome Unity Open Source On Github
A categorized collection of awesome Unity open source on GitHub (800+)
Stars: ✭ 1,124 (+950.47%)
Mutual labels:  unity, unity-editor

WebViewHook

Warning: WebViewHook is obsolete for Unity 2020 and Above due to removal of Asset Store Browsing in Unity Editor. This project is soon to be archived.

This is a code snippet to access a hidden WebView API from Unity Editor, and load it to EditorWindow.

Screenshot

Code

Download WebViewHook. See usage example in WebWindow or WebEditor. You may download the whole project if necessary.

Usage

Minimum code to get WebView working:

class WebViewDemo : EditorWindow
{

    WebViewHook webView;

    void OnEnable()
    {
        if (!webView)
        {
            // create webView
            webView = CreateInstance<WebViewHook>();
        }
    }

    public void OnBecameInvisible()
    {
        if (webView)
        {
            // signal the browser to unhook
            webView.Detach();
        }
    }

    void OnDestroy()
    {
        //Destroy web view
        DestroyImmediate(webView);
    }

    void OnGUI()
    {
        // hook to this window
        if (webView.Hook(this))
            // do the first thing to do
            webView.LoadURL("https://google.com");

        if (ev.type == EventType.Repaint)
        {
            // keep the browser aware with resize
            webView.OnGUI(new Rect(Vector2.zero, this.position.size));
        }
    }
}

Two Way Communication

Using LoadURL, LoadHTML and ExecuteJavascript you only can send information to WebView.

To extract informations from WebView you need external communication, and the easiest way to do this is by using Web Socket.

To get web socket server running you need to download WebSocket-Sharp and a script utility from this repo.

See WebData for minimal working example of using WebSocketHook to hook C# into javascript variable.

More Information and Caveats

This is an editor only solution. If you're looking to add WebView to a game build then this is not the repo you're looking for.

The technology behind WebView is Chrome Embedded Framework, version 37. In Windows it's contained inside the gigantic libcef.dll.

WebView in Unity is just like Chrome, with background-color default to darkgrey and no plugins (Flash/Java/PDF) allowed.

I solving bugs as I can, but of course limited. If you can't open a specific website, mostly comes down to the fact that Unity haven't upgrade their CEF browser.

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].