[DISCONTINUED] uWebKit - Chromium WebView for Unity 5

Important Notice:

We have licensed and supported a Unity WebView for the last 5 years and greatly enjoyed the interaction and use cases provided by our clients. Unfortunately, development on uWebKit3 has been discontinued.

Please see http://www.uwebkit.com for additional information.

If you have licensed uWebKit3 and did not receive a notification, please contact sales@uwebkit.com

If you are using the expiring beta in a project, please contact sales@uwebkit.com to receive a non-expiring build to use until a solution can be found for your project.

If you need access to a previous version of uWebKit or have any other questions, please contact sales@uwebkit.com referencing your product key or receipt id.

We greatly appreciate the support of our clients and please understand that this was a very difficult decision.

Thank you.

  • Josh Engebretson
    THUNDERBEAST GAMES LLC

Is iOS pro needed (I have Unity Pro but only iOS basic)

Hello,

uWebKit supports iOS Basic and iOS Pro. There is a fully featured evaluation available via the website.

Cheers,
Josh
http://www.uWebKit.com

Does uWebKit have any way to interact with your own custom made html pages such that Unity can respond similar to how it responds through its native GUI system?

Hello,

On Desktop, there is a powerful Javascript bridge interface for binding events and data. An example of responding to an onclick event in Unity is available here: https://github.com/TheEngineCompany/uWebKit/blob/UWEBKIT-15b/uWebKit/Assets/uWebKitExamples/Scripts/WebBrowser/UnityInfoPage.cs

On iOS, Javascript evaluation is available however due to platform limitations we really can’t do callbacks and shared objects. So, this would have to be a polling architecture.

~Josh

We recently needed to upgrade to Unity 4.2 to fix a couple of issues in our game. Now when building for iOS the auto-generated uWebKit .h files are referencing AppController.h instead of UnityAppController.h. These are easy to fix if you are doing a manual build to Xcode, but this breaks the AutoPilot feature of TestFlight which speeds up building immensely. Is this fixed in uWebKit 1.5?

Hello,

Unity 4.2 updates for iOS are currently being worked on. You can view progress on the GitHub repository: https://github.com/TheEngineCompany/uWebKit/compare/UWEBKIT-15b...UWEBKIT-iOS-Dev

I’ll update this thread once they are in the 1.5 package.

~Josh

Great to hear again from uWebKit !

Hello,

uWebKit 1.5c is now available to download from the GitHub page: https://github.com/TheEngineCompany/uWebKit

The main change is Unity 4.2 iOS support.

~Josh

Hi.

I’m a little confused about how to display a local html file as opposed to an online page.

I thought something like this would make sense, but it’s giving me errors :

using UnityEngine;
using System.Collections;
using UWK;

public class MyWebGUI : MonoBehaviour {
	
	UWKView View;
	// Use this for initialization
	void Start () {
		
		//create view
		View = UWKView.LoadURL ("MyView","file://pagetest1",1000,200);
	
	}
	
	// Update is called once per frame
	void OnGUI () {
		/// draw view
		View.OnWebGUI(500,700);
	
	}
}

How do I load the page?

Also, my apologies if you’re not answering these types of questions.

@G_Trex: Try specifying the absolute path to the file, you can also use Application.dataPath to serve local files: Unity - Scripting API: Application.dataPath

~Josh

I’m afraid using the absolute path didn’t help.

Are you saying that the code seems correct however?

If it helps, this is the error I get : An object reference is required to access non-static member `UWKView.LoadURL(string)’

Hello,

You are correct, that would be a compiler error. UWKView is the class, you can load urls on instances.

Please see this minimal example: https://github.com/TheEngineCompany/uWebKit/blob/UWEBKIT-15b/uWebKit/Assets/uWebKitExamples/Scripts/WebGUI/WebGUI.cs

You should be able to change the URL using file:// protocol

~Josh

I used the code in the link you posted and it’s working now.

Here’s the code for anyone who wants to do anything similar :

using UnityEngine;
using UWK;

/// <summary>
/// Minimal WebGUI using uWebKit and Unity GUI
/// </summary>
public class MyWebGUI : MonoBehaviour
{

// URL
public string URL = "file:// C:/Users/Greg/Desktop/pagetest1";

// position
public int X = 500;
public int Y = 0;

// dimensions
public int Width = 1024;
public int Height = 100;

// transparency
public float Transparency = 100.0f;

// the view itself
public UWKView View;

void Start ()
{	
// Create the view
View = UWKCore.CreateView ("MyView", URL, Width, Height);	
}

void OnGUI ()
{
// Draw the view
View.OnWebGUI(X, Y, Width, Height, Transparency);
}

}

Worth mentioning that with this code, altering the parameters via the inspector seems to be the best way of using it.

I have one last remaining question however. Is there a way just loading an html file from the assets folder? I could use something like C:\Users\Greg\Documents\ATD\Assets\pagetest1.html, but it would’nt work for someone playing the game on another computer (their directories would be different).

Hello,

You can include your local html in your project and generate the path via: Unity - Scripting API: Application.dataPath

~Josh

Hello,

I’m trying to get the HTML source code of current page in UrlChanged(UWKView view, string url).
How do I get the HTML source code of current page?

Hello you should be able to query the page with:

view.EvaluateJavaScript(“document.body.innerHTML;”, evalResult);

where evalResult would be:

void evalResult (object sender, CommandProcessEventArgs args)
{
Command cmd = args.Cmd;

string pageSource = Plugin.GetString(cmd.iParams[0], cmd.iParams[1]);

Debug.Log(pageSource);
}

~Josh

Thanks!

Hi
I need to display my html documents in unity app. Is it possible using this tool ?
I want to store documents in some kind data base and render them using hmm NGUI or something similar .

Hello,

I’m trying to make a test build to an iOS device, but having the following error in XCode:

I’m using the trial version of uWebKit (tried both the latest and the current beta) with Unity pro 3.5.7. on a Mac with XCode 4.6. Any idea what might cause this issue? It could easily be on my side since I’m not too familiar with Mac builds.