public void Start()
{
// Initialize the WebCore if it's not active
if (!WebCore.IsRunning)
{
WebCoreConfig conf = new WebCoreConfig();
conf.EnablePlugins = true;
WebCore.Initialize(conf);
webCoreHelper = new GameObject("WebCoreHelperInstance");
webCoreHelper.AddComponent<WebCoreHelper>();
}
webView = WebCore.CreateWebView(width, height);
webViewList.Add(webView);
LoadURL(initialURL);
texture = new Texture2D(width, height, TextureFormat.RGBA32, false);
Pixels = texture.GetPixels32(0);
PixelsHandle = GCHandle.Alloc(Pixels, GCHandleType.Pinned);
if (renderer)
{
renderer.material.mainTexture = texture;
}
else if (GetComponent(typeof(GUITexture)))
{
GUITexture gui = GetComponent(typeof(GUITexture)) as GUITexture;
gui.texture = texture;
}
else
{
Debug.Log("Game Object has no Material or GUI Texture, we cannot render a web-page to this object!");
}
}