WebView

WebView is a component of the WebViewCanvas prefab that is part of the Enoch avatar SDK. To use a WebView, create a WebViewCanvas game object by selecting GameObject > UI > WebView Canvas.

public async Task IsWebViewUpToDate()

  • Check if the WebView that will be used for displaying the RPM website is up to date for handling 3D graphics. If it returns false, it is not advised to load WebView since the browser performance will be poor. Instead, you can warn the user for them to update their system WebView applications.

Enoch avatar website will work on Android devices with System WebView with a rendering engine equal to or newer than Chrome v70 or Firefox v64, and IOS devices with Webkit WebView equal to or newer than v600. This info is checked using the userAgent string of the WebView.

public void CreateWebview()

The Enoch Avatar website will work on Android devices with System WebView with a rendering engine equal to or newer than Chrome v70 or Firefox v64, and IOS devices with Webkit WebView equal to or newer than v600. This info is checked using the userAgent string of the WebView.

Properties

PropertyTypeDescription

KeepSessionAlive

bool

If set to false, clears stored avatar data after the avatar creation is finished or when the WebView is destroyed.

By default, this is set to true.

Public Methods

MethodReturnsDescription

CreateWebview()

void

Creates the WebView window and loads the Enoch avatar website.

SetScreenPadding( int left, int top, int right, int bottom)

void

Sets the screen padding of the WebView window. Default is 0 for all sides.

SetVisible(bool visible)

void

Sets the visibility of the WebView.

ClearAvatarData()**

void

Clears avatar data from the WebView local storage and reloads the Enoch avatar page for new avatar creation.

async Task IsWebViewUpToDate()

bool

Checks if the WebView that will be used for displaying the RPM website is up to date for handling 3D graphics. If it returns false, it is not advised to load WebView since the browser performance will be poor. Instead, you can warn the user for them to update their system WebView applications.

If the cache is cleared, then the next time you open Enoch avatar in the WebView, your previous avatar will not be there, and you will start from the beginning of the avatar creation process.

Action

EventEventArgsDescription

OnAvatarCreated

<string>

Event to call when an avatar is created. Receives GLB URL.

Example

Once you have imported the Enoch avatar SDK, find an example at Plugins > Enoch avatar > Examples > Webview Example.

Last updated