Class WebBrowserClient

The main object responsible for UWB.

This class handles:

  • UWB process setup
  • Texture setup and rendering
  • Wrapper for invoking methods on the UWB process
  • Shutdown
If you need to do something with UWB, its probably here.
Inheritance
WebBrowserClient
Implements
IDisposable
Namespace: VoltstroStudios.UnityWebBrowser.Core
Assembly: .dll
Syntax
[Serializable]
public class WebBrowserClient : IDisposable

Fields

| Edit this page View Source

backgroundColor

The background UnityEngine.Color32 of the webpage

Declaration
public Color32 backgroundColor
Field Value
TypeDescription
Color32
| Edit this page View Source

cache

Enable or disable the cache

Declaration
public bool cache
Field Value
TypeDescription
bool
| Edit this page View Source

communicationLayer

Declaration
public CommunicationLayer communicationLayer
Field Value
TypeDescription
CommunicationLayer
| Edit this page View Source

engine

The active browser engine this instance is using

Declaration
public Engine engine
Field Value
TypeDescription
Engine
| Edit this page View Source

engineStartupTimeout

Timeout time for waiting for the engine to start (in milliseconds)

Declaration
public int engineStartupTimeout
Field Value
TypeDescription
int
| Edit this page View Source

initialUrl

The initial URl the browser will start at

Declaration
public string initialUrl
Field Value
TypeDescription
string
| Edit this page View Source

javascript

Enable or disable JavaScript

Declaration
public bool javascript
Field Value
TypeDescription
bool
| Edit this page View Source

jsMethodManager

Manager for JS methods

Declaration
public JsMethodManager jsMethodManager
Field Value
TypeDescription
JsMethodManager
| Edit this page View Source

localStorage

Enable or disable local storage

Declaration
public bool localStorage
Field Value
TypeDescription
bool
| Edit this page View Source

logSeverity

The log severity. Only messages of this severity level or higher will be logged

Declaration
public LogSeverity logSeverity
Field Value
TypeDescription
LogSeverity
| Edit this page View Source

popupAction

How to handle popups

Declaration
public PopupAction popupAction
Field Value
TypeDescription
PopupAction
| Edit this page View Source

processLogHandler

Declaration
public ProcessLogHandler processLogHandler
Field Value
TypeDescription
ProcessLogHandler
| Edit this page View Source

proxySettings

Proxy Settings

Declaration
public ProxySettings proxySettings
Field Value
TypeDescription
ProxySettings
| Edit this page View Source

remoteDebugging

Enable or disable remote debugging

Declaration
public bool remoteDebugging
Field Value
TypeDescription
bool
| Edit this page View Source

remoteDebuggingPort

The port to use for remote debugging

Declaration
[Range]
public uint remoteDebuggingPort
Field Value
TypeDescription
uint
| Edit this page View Source

webRtc

Enable or disable WebRTC

Declaration
public bool webRtc
Field Value
TypeDescription
bool

Properties

| Edit this page View Source

BrowserTexture

Texture that the browser will paint to

Declaration
public Texture2D BrowserTexture { get; }
Property Value
TypeDescription
Texture2D
| Edit this page View Source

CachePath

The path to the cache

Declaration
public FileInfo CachePath { get; set; }
Property Value
TypeDescription
FileInfo
Exceptions
TypeCondition
UwbIsConnectedException
ArgumentException
ArgumentNullException
| Edit this page View Source

FPS

Internal FPS of pixels communication between Unity and the Engine

Declaration
public int FPS { get; }
Property Value
TypeDescription
int
| Edit this page View Source

HasDisposed

Has this object been disposed

Declaration
public bool HasDisposed { get; }
Property Value
TypeDescription
bool
| Edit this page View Source

HasInitialized

Has UWB initialized

Declaration
public bool HasInitialized { get; }
Property Value
TypeDescription
bool
| Edit this page View Source

IsConnected

Are we connected to the UW engine process

Declaration
public bool IsConnected { get; }
Property Value
TypeDescription
bool
| Edit this page View Source

LogPath

The path that UWB engine will log to

Declaration
public FileInfo LogPath { get; set; }
Property Value
TypeDescription
FileInfo
Exceptions
TypeCondition
UwbIsConnectedException
ArgumentNullException
| Edit this page View Source

Logger

Gets the IWebBrowserLogger to use for logging

Declaration
public IWebBrowserLogger Logger { get; set; }
Property Value
TypeDescription
IWebBrowserLogger
Exceptions
TypeCondition
ArgumentNullException
| Edit this page View Source

ReadySignalReceived

The UWB engine has signaled that it is ready

Declaration
public bool ReadySignalReceived { get; }
Property Value
TypeDescription
bool
| Edit this page View Source

Resolution

The resolution of the browser.

There is a chance that resizing the screen causes UWB to crash Unity, use carefully!

Resizing in performance mode is not supported!

Declaration
public Shared.Resolution Resolution { get; set; }
Property Value
TypeDescription
Resolution

Methods

| Edit this page View Source

Dispose()

Destroys this WebBrowserClient instance

Declaration
public void Dispose()
| Edit this page View Source

ExecuteJs(string)

Executes JS in the browser

Declaration
public void ExecuteJs(string js)
Parameters
TypeNameDescription
stringjs
| Edit this page View Source

~WebBrowserClient()

Declaration
protected ~WebBrowserClient()
| Edit this page View Source

GetScrollPosition()

Gets the mouse scroll position

THIS IS INVOKED ON THE THREAD THAT IS CALLING THIS AND IS BLOCKING

Declaration
public Vector2 GetScrollPosition()
Returns
TypeDescription
Vector2

Returns the mouse scroll position as a Vector2

| Edit this page View Source

GetZoomLevel()

Get's browser's zoom level

Declaration
public double GetZoomLevel()
Returns
TypeDescription
double
| Edit this page View Source

GoBack()

Tells the browser to go back

Declaration
public void GoBack()
| Edit this page View Source

GoForward()

Tells the browser to go forward

Declaration
public void GoForward()
| Edit this page View Source

LoadHtml(string)

Makes the browser load html

Declaration
public void LoadHtml(string html)
Parameters
TypeNameDescription
stringhtml
| Edit this page View Source

LoadTextureData()

Loads the pixel data into the BrowserTexture

Declaration
public void LoadTextureData()
| Edit this page View Source

LoadUrl(string)

Tells the browser to load a URL

Declaration
public void LoadUrl(string url)
Parameters
TypeNameDescription
stringurl
| Edit this page View Source

OpenDevTools()

Shows dev tools

Declaration
public void OpenDevTools()
| Edit this page View Source

Refresh()

Refreshes the browser

Declaration
public void Refresh()
| Edit this page View Source

RegisterJsMethod(string, Action)

Registers a method with JsMethodManager

Declaration
public void RegisterJsMethod(string name, Action method)
Parameters
TypeNameDescription
stringname
Actionmethod
Exceptions
TypeCondition
ArgumentNullException
| Edit this page View Source

RegisterJsMethod<T>(string, Action<T>)

Registers a method with JsMethodManager

Declaration
public void RegisterJsMethod<T>(string name, Action<T> method)
Parameters
TypeNameDescription
stringname
Action<T>method
Type Parameters
NameDescription
T
Exceptions
TypeCondition
ArgumentNullException
| Edit this page View Source

RegisterJsMethod<T1, T2>(string, Action<T1, T2>)

Registers a method with JsMethodManager

Declaration
public void RegisterJsMethod<T1, T2>(string name, Action<T1, T2> method)
Parameters
TypeNameDescription
stringname
Action<T1, T2>method
Type Parameters
NameDescription
T1
T2
Exceptions
TypeCondition
ArgumentNullException
| Edit this page View Source

RegisterJsMethod<T1, T2, T3>(string, Action<T1, T2, T3>)

Registers a method with JsMethodManager

Declaration
public void RegisterJsMethod<T1, T2, T3>(string name, Action<T1, T2, T3> method)
Parameters
TypeNameDescription
stringname
Action<T1, T2, T3>method
Type Parameters
NameDescription
T1
T2
T3
Exceptions
TypeCondition
ArgumentNullException
| Edit this page View Source

RegisterJsMethod<T1, T2, T3, T4>(string, Action<T1, T2, T3, T4>)

Registers a method with JsMethodManager

Declaration
public void RegisterJsMethod<T1, T2, T3, T4>(string name, Action<T1, T2, T3, T4> method)
Parameters
TypeNameDescription
stringname
Action<T1, T2, T3, T4>method
Type Parameters
NameDescription
T1
T2
T3
T4
Exceptions
TypeCondition
ArgumentNullException
| Edit this page View Source

RegisterJsMethod<T1, T2, T3, T4, T5>(string, Action<T1, T2, T3, T4, T5>)

Registers a method with JsMethodManager

Declaration
public void RegisterJsMethod<T1, T2, T3, T4, T5>(string name, Action<T1, T2, T3, T4, T5> method)
Parameters
TypeNameDescription
stringname
Action<T1, T2, T3, T4, T5>method
Type Parameters
NameDescription
T1
T2
T3
T4
T5
Exceptions
TypeCondition
ArgumentNullException
| Edit this page View Source

RegisterJsMethod<T1, T2, T3, T4, T5, T6>(string, Action<T1, T2, T3, T4, T5, T6>)

Registers a method with JsMethodManager

Declaration
public void RegisterJsMethod<T1, T2, T3, T4, T5, T6>(string name, Action<T1, T2, T3, T4, T5, T6> method)
Parameters
TypeNameDescription
stringname
Action<T1, T2, T3, T4, T5, T6>method
Type Parameters
NameDescription
T1
T2
T3
T4
T5
T6
Exceptions
TypeCondition
ArgumentNullException
| Edit this page View Source

Resize(Resolution)

Resizes the screen.

Declaration
public void Resize(Shared.Resolution newResolution)
Parameters
TypeNameDescription
ResolutionnewResolution
Exceptions
TypeCondition
UwbIsNotConnectedException
NotSupportedException
| Edit this page View Source

SendKeyboardControls(WindowsKey[], WindowsKey[], char[])

Sends a keyboard event

Declaration
public void SendKeyboardControls(WindowsKey[] keysDown, WindowsKey[] keysUp, char[] chars)
Parameters
TypeNameDescription
WindowsKey[]keysDown
WindowsKey[]keysUp
char[]chars
| Edit this page View Source

SendMouseClick(Vector2, int, MouseClickType, MouseEventType)

Sends a mouse click event

Declaration
public void SendMouseClick(Vector2 mousePos, int clickCount, MouseClickType clickType, MouseEventType eventType)
Parameters
TypeNameDescription
Vector2mousePos
intclickCount
MouseClickTypeclickType
MouseEventTypeeventType
| Edit this page View Source

SendMouseMove(Vector2)

Sends a mouse event

Declaration
public void SendMouseMove(Vector2 mousePos)
Parameters
TypeNameDescription
Vector2mousePos
| Edit this page View Source

SendMouseScroll(Vector2, int)

Sends a mouse scroll event

Declaration
public void SendMouseScroll(Vector2 mousePos, int mouseScroll)
Parameters
TypeNameDescription
Vector2mousePos
intmouseScroll
| Edit this page View Source

SetZoomLevel(double)

Set browser's zoom level. Use 0.0 to reset.

Declaration
public void SetZoomLevel(double zoomLevel)
Parameters
TypeNameDescription
doublezoomLevel
| Edit this page View Source

SetZoomLevelPercent(double)

Sets zoom level based off a percentage

Declaration
public void SetZoomLevelPercent(double percent)
Parameters
TypeNameDescription
doublepercent
Exceptions
TypeCondition
ArgumentOutOfRangeException

Thrown if percent is 0 or less

| Edit this page View Source

UpdateFps()

Updates FPS values

Normal usage shouldn't require invoking this

Declaration
public void UpdateFps()

Events

| Edit this page View Source

OnClientConnected

Invoked when this WebBrowserClient connects to the engine

Declaration
public event OnClientConnected OnClientConnected
Event Type
TypeDescription
OnClientConnected
| Edit this page View Source

OnClientInitialized

Invoked when this WebBrowserClient initalizes.

Initialized does not mean that the engine is ready, for that, use OnClientConnected

Declaration
public event OnClientInitialized OnClientInitialized
Event Type
TypeDescription
OnClientInitialized
| Edit this page View Source

OnFullscreen

Invoked when the browser goes in or out of fullscreen

Declaration
public event OnFullscreenChange OnFullscreen
Event Type
TypeDescription
OnFullscreenChange
| Edit this page View Source

OnInputFocus

Declaration
public event OnInputFocus OnInputFocus
Event Type
TypeDescription
OnInputFocus
| Edit this page View Source

OnLoadFinish

Invoked when the page finishes loading

Declaration
public event OnLoadFinishDelegate OnLoadFinish
Event Type
TypeDescription
OnLoadFinishDelegate
| Edit this page View Source

OnLoadProgressChange

Invoked when the loading progress changes

Progress goes from 0 to 1

Declaration
public event OnLoadingProgressChange OnLoadProgressChange
Event Type
TypeDescription
OnLoadingProgressChange
| Edit this page View Source

OnLoadStart

Invoked when the page starts to load

Declaration
public event OnLoadStartDelegate OnLoadStart
Event Type
TypeDescription
OnLoadStartDelegate
| Edit this page View Source

OnPopup

Invoked when the browser gets a popup

Declaration
public event OnPopup OnPopup
Event Type
TypeDescription
OnPopup
| Edit this page View Source

OnTitleChange

Invoked when the title changes

Declaration
public event OnTitleChange OnTitleChange
Event Type
TypeDescription
OnTitleChange
| Edit this page View Source

OnUrlChanged

Invoked when the url changes

Declaration
public event OnUrlChangeDelegate OnUrlChanged
Event Type
TypeDescription
OnUrlChangeDelegate

Implements

IDisposable