Class WebGLAPI
WebGLAPI
Inherited Members
Namespace: UnityEngine.Industrial.Forma.WebGLAPI
Syntax
[RequireComponent(typeof(Configurator))]
public class WebGLAPI : MonoBehaviour
Properties
HideFormaRuntimeUIInBuild
HideFormaRuntimeUIInBuild
Declaration
public bool HideFormaRuntimeUIInBuild { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
AddCatalogs(String)
Add catalogs from a product source.
Declaration
[MonoPInvokeCallback(typeof(Action<int>))]
public static void AddCatalogs(string productSourceInfoJson)
Parameters
Type | Name | Description |
---|---|---|
String | productSourceInfoJson | Json product source data |
CreateProductSource(String)
Create Product source.
Declaration
[MonoPInvokeCallback(typeof(Func<int, int>))]
public static string CreateProductSource(string productSourceJson)
Parameters
Type | Name | Description |
---|---|---|
String | productSourceJson | Json product source data |
Returns
Type | Description |
---|---|
String | Json string of json product source |
GetCameras()
Gets the list of cameras available that are currently available
Declaration
[MonoPInvokeCallback(typeof(Func<int>))]
public static string GetCameras()
Returns
Type | Description |
---|---|
String | The list of cameras as a string in JSON format. The list can be empty but will not be null. |
GetContexts()
Gets the list of contexts that are currently available
Declaration
[MonoPInvokeCallback(typeof(Func<int>))]
public static string GetContexts()
Returns
Type | Description |
---|---|
String | The list of contexts as a string in JSON format. The list can be empty but will not be null. |
GetCurrentCamera()
Get information about the current camera that can be displayed in a UI
Declaration
[MonoPInvokeCallback(typeof(Func<int>))]
public static string GetCurrentCamera()
Returns
Type | Description |
---|---|
String | Information about the camera as a string in JSON format, or null if the current camera is null |
GetCurrentEnvironment()
Get information about the current environment that can be displayed in a UI
Declaration
[MonoPInvokeCallback(typeof(Func<int>))]
public static string GetCurrentEnvironment()
Returns
Type | Description |
---|---|
String | Information about the environment as a string in JSON format, or null is the current environment is null |
GetCurrentProduct()
Get information about the current product that can be displayed in a UI
Declaration
[MonoPInvokeCallback(typeof(Func<int>))]
public static string GetCurrentProduct()
Returns
Type | Description |
---|---|
String | Information about the product as a string in JSON format, or null if the current product is null |
GetCurrentProductIndex()
The index of the current configurator product
Declaration
[MonoPInvokeCallback(typeof(Func<int>))]
public static int GetCurrentProductIndex()
Returns
Type | Description |
---|---|
Int32 | An int value representing the 0-based index of the product |
GetEnvironments()
Gets the list of environments that are currently available
Declaration
[MonoPInvokeCallback(typeof(Func<int>))]
public static string GetEnvironments()
Returns
Type | Description |
---|---|
String | The list of environments as a string in JSON format. The list can be empty but will not be null. |
GetFeatures(String)
Gets the list of features that are currently available. This method is asynchronous and will raise an event containing the features as a string in JSON format when ready. The list can be empty but will not be null.
Declaration
[MonoPInvokeCallback(typeof(Action<int>))]
public static async void GetFeatures(string featureSetCode)
Parameters
Type | Name | Description |
---|---|---|
String | featureSetCode |
GetFeatureSets()
Gets the list of feature sets that are currently available. This method is asynchronous and will raise an event containing the feature sets as a string in JSON format when ready. The list can be empty but will not be null.
Declaration
[MonoPInvokeCallback(typeof(Action))]
public static void GetFeatureSets()
GetProducts()
Gets the list of products that are currently available
Declaration
[MonoPInvokeCallback(typeof(Func<int>))]
public static string GetProducts()
Returns
Type | Description |
---|---|
String | The list of product names as a string in JSON format. The list can be empty but will not be null. |
GetProductSources()
Get Product sources.
Declaration
[MonoPInvokeCallback(typeof(Func<int>))]
public static string GetProductSources()
Returns
Type | Description |
---|---|
String | Json string of json product source list. |
GetSelectedFeature(String)
Get the currently selected feature for the specified feature set.
Declaration
[MonoPInvokeCallback(typeof(Func<int, int>))]
public static string GetSelectedFeature(string featureSetCode)
Parameters
Type | Name | Description |
---|---|---|
String | featureSetCode | The identifier of the feature set |
Returns
Type | Description |
---|---|
String | The feature identifier as a string, or null not found. |
GetTransparentBackground()
Note: This feature needs to be enabled first in the project under "Forma/Advanced/Enable WebGL Transparent Background"
Declaration
[MonoPInvokeCallback(typeof(Func<int>))]
public static int GetTransparentBackground()
Returns
Type | Description |
---|---|
Int32 | Enabled(1) or Disable(0) the transparent background. |
RemoteProcedureCall(String)
RemoteProcedureCall
Declaration
[MonoPInvokeCallback(typeof(Func<int, int>))]
public static string RemoteProcedureCall(string arg)
Parameters
Type | Name | Description |
---|---|---|
String | arg | String to populate RPCArg from |
Returns
Type | Description |
---|---|
String | result as json |
RemoveCatalogs(String)
Remove catalogs from a product source.
Declaration
[MonoPInvokeCallback(typeof(Action<int>))]
public static void RemoveCatalogs(string productSourceInfoJson)
Parameters
Type | Name | Description |
---|---|---|
String | productSourceInfoJson | Json product source data |
RemoveProductSource(String)
Remove a product source.
Declaration
[MonoPInvokeCallback(typeof(Action<int>))]
public static void RemoveProductSource(string id)
Parameters
Type | Name | Description |
---|---|---|
String | id | Id of product source to add catalog to |
SelectFeature(String)
Select or deselect the specified feature on the current configurator product
Declaration
[MonoPInvokeCallback(typeof(Action<int>))]
public static void SelectFeature(string featureCode)
Parameters
Type | Name | Description |
---|---|---|
String | featureCode | The identifier of the feature |
SetCaptureAllKeyboardInput(Int32)
Set to false so elements in web page can handle keyboard inputs.
Declaration
[MonoPInvokeCallback(typeof(Action<int>))]
public static void SetCaptureAllKeyboardInput(int allKeyboardInput)
Parameters
Type | Name | Description |
---|---|---|
Int32 | allKeyboardInput | True(1) or False(0) |
SetTransparentBackground(Int32)
Note: This feature needs to be enabled first in the project under "Forma/Advanced/Enable WebGL Transparent Background" Enabled or Disable the transparent background.
Declaration
[MonoPInvokeCallback(typeof(Action<int>))]
public static void SetTransparentBackground(int value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | value | Enabled(1) or Disable(0) the transparent background. |
SwitchCamera(String)
Switches the current camera of the configurator
Declaration
[MonoPInvokeCallback(typeof(Action<int>))]
public static void SwitchCamera(string id)
Parameters
Type | Name | Description |
---|---|---|
String | id | The id of the camera to switch to |
SwitchContext(String, String)
Switches the context of the configurator
Declaration
[MonoPInvokeCallback(typeof(Action<int, int>))]
public static void SwitchContext(string key, string value)
Parameters
Type | Name | Description |
---|---|---|
String | key | The identifier of the context to switch |
String | value | The value to set for the specified context |
SwitchEnvironment(String)
Switches the current environment of the configurator
Declaration
[MonoPInvokeCallback(typeof(Action<int>))]
public static void SwitchEnvironment(string id)
Parameters
Type | Name | Description |
---|---|---|
String | id | The id of the environment to switch to |
SwitchProduct(Int32)
Switches the current product of the configurator
Declaration
[MonoPInvokeCallback(typeof(Action<int>))]
public static void SwitchProduct(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the product to switch to |
UnloadCurrentProduct()
Unload currently loaded product
Declaration
[MonoPInvokeCallback(typeof(Action))]
public static void UnloadCurrentProduct()