New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-unity-webgl

Package Overview
Dependencies
Maintainers
1
Versions
119
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-unity-webgl - npm Package Compare versions

Comparing version 8.8.0 to 9.0.0

distribution/components/unity-component.d.ts

19

distribution/hooks/use-unity-instance.d.ts

@@ -1,15 +0,14 @@

import { IUnityInstanceParameters } from "../interfaces/unity-instance-parameters";
import { Status as UnityLoaderStatus } from "./use-unity-loader";
import { IUnityArguments } from "../interfaces/unity-arguments";
import { IUnityProvider } from "../interfaces/unity-provider";
import { UnityLoaderStatus } from "../enums/unity-loader-status";
/**
* Creates a Unity Instance.
* @param unityLoaderStatus The loader status
* @param htmlCanvasElement A reference to the html canvas element
* @param unityInstanceParameters The Unity instance parameters
* @param unityLoaderStatus The loader status.
* @param htmlCanvasElement A reference to the html canvas element.
* @param unityArguments The Unity instance arguments.
* @param unityProvider The Unity provider.
* @returns the Unity Instance among with the status of the Unity Instance.
*/
export declare function useUnityInstance(unityLoaderStatus: UnityLoaderStatus, htmlCanvasElement: HTMLCanvasElement | null, unityInstanceParameters: IUnityInstanceParameters): {
unityInstance: UnityInstance | null;
progression: number;
error: string | null;
};
declare const useUnityInstance: (unityLoaderStatus: UnityLoaderStatus, htmlCanvasElement: HTMLCanvasElement | null, unityArguments: IUnityArguments, unityProvider: IUnityProvider) => void;
export { useUnityInstance };
//# sourceMappingURL=use-unity-instance.d.ts.map

@@ -41,62 +41,60 @@ "use strict";

var react_1 = require("react");
var use_unity_loader_1 = require("./use-unity-loader");
var unity_loader_status_1 = require("../enums/unity-loader-status");
var is_browser_environment_1 = require("../constants/is-browser-environment");
/**
* Creates a Unity Instance.
* @param unityLoaderStatus The loader status
* @param htmlCanvasElement A reference to the html canvas element
* @param unityInstanceParameters The Unity instance parameters
* @param unityLoaderStatus The loader status.
* @param htmlCanvasElement A reference to the html canvas element.
* @param unityArguments The Unity instance arguments.
* @param unityProvider The Unity provider.
* @returns the Unity Instance among with the status of the Unity Instance.
*/
function useUnityInstance(unityLoaderStatus, htmlCanvasElement, unityInstanceParameters) {
var _a = (0, react_1.useState)(0), progression = _a[0], setProgression = _a[1];
var _b = (0, react_1.useState)(null), error = _b[0], setError = _b[1];
var _c = (0, react_1.useState)(null), unityInstance = _c[0], setUnityInstance = _c[1];
var useUnityInstance = function (unityLoaderStatus, htmlCanvasElement, unityArguments, unityProvider) {
// Effect invoked when the Unity Loader status or canvas reference changes.
(0, react_1.useEffect)(function () {
(function () {
return __awaiter(this, void 0, void 0, function () {
var unityInstance_1, error_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (unityLoaderStatus !== use_unity_loader_1.Status.Loaded ||
htmlCanvasElement === null) {
// If the loader is not loaded, or the canvas is not available,
// we can't create the Unity instance yet.
setUnityInstance(null);
return [2 /*return*/];
}
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
// It is possible for the application being rendered server side. In
// this scenario, the window is not available. We can't create the
// Unity Instance in this case.
if (typeof window === "undefined") {
return [2 /*return*/];
}
return [4 /*yield*/, window.createUnityInstance(htmlCanvasElement, unityInstanceParameters, setProgression)];
case 2:
unityInstance_1 = _a.sent();
// When the Unity Instance is created, its reference is stored in the
// state while the error state is cleared.
setUnityInstance(unityInstance_1);
setError(null);
return [3 /*break*/, 4];
case 3:
error_1 = _a.sent();
// When the Unity Instance catches due to a fail during the creation,
// the Unity Instnace reference will be cleared while the error is
// placed into the state.
setUnityInstance(null);
setError(error_1);
return [3 /*break*/, 4];
case 4: return [2 /*return*/];
}
});
(function () { return __awaiter(void 0, void 0, void 0, function () {
var unityInstance, error_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
// It is possible for the application being rendered server side. In
// this scenario, the window is not available. We can't create the
// Unity Instance in this case.
if (is_browser_environment_1.isBrowserEnvironment === false) {
return [2 /*return*/];
}
if (unityLoaderStatus !== unity_loader_status_1.UnityLoaderStatus.Loaded ||
htmlCanvasElement === null) {
// If the loader is not loaded, or the canvas is not available,
// we can't create the Unity instance yet. In case of a fresh load,
// we'll clear the initialisation error as well.
unityProvider.setUnityInstance(null);
unityProvider.setInitialisationError(null);
return [2 /*return*/];
}
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, window.createUnityInstance(htmlCanvasElement, unityArguments, unityProvider.setLoadingProgression)];
case 2:
unityInstance = _a.sent();
// When the Unity Instance is created, its reference is stored in the
// state while the error state is cleared.
unityProvider.setUnityInstance(unityInstance);
unityProvider.setInitialisationError(null);
return [3 /*break*/, 4];
case 3:
error_1 = _a.sent();
// When the Unity Instance catches due to a fail during the creation,
// the Unity Instnace reference will be cleared while the error is
// placed into the state.
unityProvider.setUnityInstance(null);
unityProvider.setInitialisationError(error_1);
return [3 /*break*/, 4];
case 4: return [2 /*return*/];
}
});
})();
}, [unityLoaderStatus, htmlCanvasElement]);
return { unityInstance: unityInstance, progression: progression, error: error };
}
}); })();
}, [unityLoaderStatus, htmlCanvasElement, unityArguments, unityProvider]);
};
exports.useUnityInstance = useUnityInstance;

@@ -1,13 +0,9 @@

export declare enum Status {
Idle = "Idle",
Loading = "Loading",
Loaded = "Loaded",
Error = "Error"
}
import { UnityLoaderStatus } from "../enums/unity-loader-status";
/**
* Hook to embed a Unity Loader script.
* @param src The source of the unity loader
* @returns a hook that returns the status of the loader
* @param source The source of the unity loader.
* @returns a hook that returns the status of the loader.
*/
export declare function useUnityLoader(src: string): Status;
declare const useUnityLoader: (source: string) => UnityLoaderStatus;
export { useUnityLoader };
//# sourceMappingURL=use-unity-loader.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useUnityLoader = exports.Status = void 0;
exports.useUnityLoader = void 0;
var react_1 = require("react");
var Status;
(function (Status) {
Status["Idle"] = "Idle";
Status["Loading"] = "Loading";
Status["Loaded"] = "Loaded";
Status["Error"] = "Error";
})(Status = exports.Status || (exports.Status = {}));
var is_browser_environment_1 = require("../constants/is-browser-environment");
var unity_loader_status_1 = require("../enums/unity-loader-status");
/**
* Hook to embed a Unity Loader script.
* @param src The source of the unity loader
* @returns a hook that returns the status of the loader
* @param source The source of the unity loader.
* @returns a hook that returns the status of the loader.
*/
function useUnityLoader(src) {
var _a = (0, react_1.useState)(src ? Status.Loading : Status.Idle), status = _a[0], setStatus = _a[1];
// Effect hook will be invoked when the src changes.
var useUnityLoader = function (source) {
var _a = (0, react_1.useState)(unity_loader_status_1.UnityLoaderStatus.Loading), status = _a[0], setStatus = _a[1];
// Effect hook will be invoked when the source changes.
(0, react_1.useEffect)(function () {
if (src === null) {
setStatus(Status.Idle);
// It is possible for the application being rendered server side. In
// this scenario, the window is not available. We can't create a Unity
// Loader in this case.
if (is_browser_environment_1.isBrowserEnvironment === false) {
return;
}
// Fetch existing script element by src
// It may have been added by another instance of this hook
var script = document.querySelector("script[src=\"".concat(src, "\"]"));
// If the script's source is null, we'll reset the status to idle.
if (source === null) {
setStatus(unity_loader_status_1.UnityLoaderStatus.Idle);
return;
}
/**
* Find existing script element by source. It may have been added by
* another instance of this hook.
*/
var script = window.document.querySelector("script[src=\"".concat(source, "\"]"));
// If there wan't another instance of this script, we're going to create a
// new one with the provided source.
if (script === null) {
// Create script
script = document.createElement("script");
script.src = src;
script = window.document.createElement("script");
script.src = source;
script.async = true;
script.setAttribute("data-status", "loading");
// Add script to document body
document.body.appendChild(script);
// Store status in attribute on script
// This can be read by other instances of this hook
var setAttributeFromEvent = function (event) {
script === null || script === void 0 ? void 0 : script.setAttribute("data-status", event.type === "load" ? "ready" : "error");
};
script.addEventListener("load", setAttributeFromEvent);
script.addEventListener("error", setAttributeFromEvent);
// Add script to window.document body.
window.document.body.appendChild(script);
// Store status in attribute on script. This can be read by other
// instances of this hook.
script.addEventListener("load", function () {
return script === null || script === void 0 ? void 0 : script.setAttribute("data-status", "loaded");
});
script.addEventListener("error", function () {
return script === null || script === void 0 ? void 0 : script.setAttribute("data-status", "error");
});
}
else {
// Grab existing script status from attribute and set to state.
setStatus(script.getAttribute("data-status") === "ready"
? Status.Loaded
: Status.Error);
// If there already was a script with the same source, grab its existing
// script status from attribute and set to state.
setStatus(script.getAttribute("data-status") === "loaded"
? unity_loader_status_1.UnityLoaderStatus.Loaded
: unity_loader_status_1.UnityLoaderStatus.Error);
}
// Script event handler to update status in state
// Note: Even if the script already exists we still need to add
// event handlers to update the state for *this* hook instance.
/**
* Script event handler to update status in state. Even if the script
* already exists we still need to add event handlers to update the state
* for this hook instance.
* @param event The event that was triggered.
*/
var setStateFromEvent = function (event) {
setStatus(event.type === "load" ? Status.Loaded : Status.Error);
return setStatus(event.type === "load"
? unity_loader_status_1.UnityLoaderStatus.Loaded
: unity_loader_status_1.UnityLoaderStatus.Error);
};
// Add event listeners
script.addEventListener("load", setStateFromEvent);
script.addEventListener("error", setStateFromEvent);
// Remove event listeners on cleanup
// Remove event listeners on cleanup.
return function () {
if (script) {
if (script !== null) {
script.removeEventListener("load", setStateFromEvent);
script.removeEventListener("error", setStateFromEvent);
document.body.removeChild(script);
window.document.body.removeChild(script);
}
};
}, [src] // Only re-run effect if script src changes
);
}, [source]);
return status;
}
};
exports.useUnityLoader = useUnityLoader;
import { IWebGLContextAttributes } from "./webgl-context-attributes";
export interface IUnityConfig {
/**
* The Unity config is provided when instantiating a Unity context. This config
* will eventually be used to create the Unity arguments which will be passed
* to the create Unity instance method in order to initialize it.
*/
interface IUnityConfig {
/**
* The url to the build json file generated by Unity. When using a relative url,
* keep in mind this is relative from the path where your html file is served.
* @public
* @readonly
* @type {string}
*/

@@ -14,5 +16,2 @@ readonly loaderUrl: string;

* keep in mind this is relative from the path where your html file is served.
* @public
* @readonly
* @type {string}
*/

@@ -23,5 +22,2 @@ readonly dataUrl: string;

* keep in mind this is relative from the path where your html file is served.
* @public
* @readonly
* @type {string}
*/

@@ -32,16 +28,15 @@ readonly frameworkUrl: string;

* keep in mind this is relative from the path where your html file is served.
* @public
* @readonly
* @type {string}
*/
readonly codeUrl: string;
/**
* The url to the framework file generated by Unity. When using a relative
* url, keep in mind this is relative from the path where your html file is
* served. This is set to the memory file when memory is stored in an external
* file, otherwise it is set to an empty string.
* @public
* @readonly
* @type {string}
* The url where the streaming assets can be found. When using a relative url,
* keep in mind this is relative from the path where your html file is served.
*/
readonly streamingAssetsUrl?: string;
/**
* The url to the framework file generated by Unity. When using a relative url,
* keep in mind this is relative from the path where your html file is served.
* This is set to the memory file when memory is stored in an external file,
* otherwise it is set to an empty string.
*/
readonly memoryUrl?: string;

@@ -54,34 +49,17 @@ /**

* string.
* @public
* @readonly
* @type {string}
*/
readonly symbolsUrl?: string;
/**
* The url where the streaming assets can be found. When using a relative url,
* keep in mind this is relative from the path where your html file is served.
* @public
* @readonly
* @type {string}
* The application's company name. This argument is treated as meta data
* which will be provided to the Unity Instance.
*/
readonly streamingAssetsUrl?: string;
/**
* The applications company name.
* @public
* @readonly
* @type {string}
*/
readonly companyName?: string;
/**
* The applications product name.
* @public
* @readonly
* @type {string}
* The application's product name. This argument is treated as meta data
* which will be provided to the Unity Instance.
*/
readonly productName?: string;
/**
* The applications product version.
* @public
* @readonly
* @type {string}
* The application's product version. This argument is treated as meta data
* which will be provided to the Unity Instance.
*/

@@ -92,5 +70,2 @@ readonly productVersion?: string;

* which will be pass additional context attributes to the Unity canvas.
* @public
* @readonly
* @type {IWebGLContextAttributes}
* @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext

@@ -100,2 +75,3 @@ */

}
export type { IUnityConfig };
//# sourceMappingURL=unity-config.d.ts.map
import { CSSProperties } from "react";
import { UnityContext } from "../library/unity-context";
export interface IUnityProps {
import { IUnityProvider } from "./unity-provider";
/**
* The Unity component's props.
*/
interface IUnityProps {
/**
* The Context which should be rendered be the Unity Component.
* @public
* @readonly
* @type {UnityContext}
* The Provider of the Unity Context which should be rendered be the Unity
* Component.
*/
readonly unityContext: UnityContext;
readonly unityProvider: IUnityProvider;
/**
* The Class Name will be applied to the Canvas.
* @public
* @readonly
* @type {string}
*/
className?: string;
readonly className?: string;
/**
* The styles will be applied to the Canvas.
* @public
* @readonly
* @type {CSSProperties}
*/
style?: CSSProperties;
readonly style?: CSSProperties;
/**

@@ -29,8 +24,5 @@ * The tabIndex of the element. Mitigates the issue that once WebGL is loaded,

* strokes anymore.
* @public
* @readonly
* @type {number}
* @see https://stackoverflow.com/a/60854680
*/
tabIndex?: number;
readonly tabIndex?: number;
/**

@@ -40,5 +32,2 @@ * The Canvas can appear too blurry on retina screens. The devicePixelRatio

* sharper image.
* @public
* @readonly
* @type {number}
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio

@@ -52,5 +41,2 @@ */

* Supported since Unity 2021.1.0b8
* @public
* @readonly
* @type {boolean}
* @see https://issuetracker.unity3d.com/issues/webgl-builds-dont-allow-separate-control-on-canvas-render-buffer-size

@@ -60,2 +46,3 @@ */

}
export type { IUnityProps };
//# sourceMappingURL=unity-props.d.ts.map
/**
* WebGLContextAttributes object that contains the actual context parameters.
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext#parameters (@WebGL context attributes)
* @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getContextAttributes
*/
export interface IWebGLContextAttributes {
interface IWebGLContextAttributes {
/**
* If set to true, the context contains an alpha (transparency) buffer.
* @public
* @readonly
* @type {boolean}
* If set to true, the context will have an alpha (transparency) channel.
* @default true

@@ -16,33 +12,4 @@ */

/**
* If set to true, the context is requested to have a 16 bit depth buffer.
* @public
* @readonly
* @type {boolean}
* @default true
*/
readonly depth?: boolean;
/**
* If set to true, the context is requested to have a stencil buffer of at
* least 8 bits.
* @public
* @readonly
* @type {boolean}
* @default false
*/
readonly stencil?: boolean;
/**
* If set to true, this hints the user agent (browser) to reduce the latency
* by desynchronizing the context paint cycle from the event loop.
* @public
* @readonly
* @type {boolean}
* @default false
*/
readonly desynchronized?: boolean;
/**
* If set to true, the context will attempt to perform antialiased rendering
* if possible.
* @public
* @readonly
* @type {boolean}
* @default true

@@ -52,2 +19,10 @@ */

/**
* If set to true, the context will have a 16 bit depth buffer. Defaults to
* true. Use gl.enable(DEPTH_TEST) to enable the depth test and
* gl.depthFunc(), gl.depthMask(), and gl.depthRange() to configure the depth
* test.
* @default true
*/
readonly depth?: boolean;
/**
* If the value is true, context creation will fail if the implementation

@@ -61,5 +36,2 @@ * determines that the performance of the created WebGL context would be

* with the rest of the page, significantly reducing performance.
* @public
* @readonly
* @type {boolean}
* @default false

@@ -69,18 +41,10 @@ */

/**
* Provides a hint to the user agent (browser) indicating what configuration
* of GPU is suitable for this WebGL context. This may influence which GPU is
* used in a system with multiple GPUs. For example, a dual-GPU system might
* have one GPU that consumes less power at the expense of rendering
* performance. Note that this property is only a hint and a WebGL
* implementation may choose to ignore it. WebGL implementations use context
* lost and restoredevents to regulate power and memory consumption,
* regardless of the value of this attribute.
* - default: Let the user agent (browser) decide which GPU configuration is
* most suitable.
* - high-performance: Prioritizes rendering performance over power
* consumption.
* - low-power: Prioritizes power saving over rendering performance.
* @public
* @readonly
* @type {"default" | "high-performance" | "low-power"}
* Provides a hint to the user agent indicating what configuration of GPU is
* suitable for this WebGL context. This may influence which GPU is used in a
* system with multiple GPUs. For example, a dual-GPU system might have one
* GPU that consumes less power at the expense of rendering performance.
* Note that this property is only a hint and a WebGL implementation may
* choose to ignore it. WebGL implementations use context lost and restored
* events to regulate power and memory consumption, regardless of the value of
* this attribute.
* @default "default"

@@ -90,8 +54,4 @@ */

/**
* If set to true, page compositor will assume the drawing buffer contains colors
* with pre-multiplied alpha. (The color channels in the framebuffer should be
* stored premultipled by the alpha channel to improve performance.)
* @public
* @readonly
* @type {boolean}
* If set to true, the color channels in the framebuffer will be stored
* premultipled by the alpha channel to improve performance.
* @default true

@@ -101,10 +61,7 @@ */

/**
* If set to true, the buffers will not be cleared and will preserve their values
* until cleared or overwritten by the author. If you wish to use canvas.toDataURL()
* you will either need to draw to the canvas immediately before calling toDataURL()
* or set preserveDrawingBuffer to true to keep the buffer available after the
* browser has displayed the buffer (at the cost of increased memory use).
* @public
* @readonly
* @type {boolean}
* If set to false, the buffer will be cleared after rendering. If you wish to
* use canvas.toDataURL(), you will either need to draw to the canvas
* immediately before calling toDataURL(), or set preserveDrawingBuffer to
* true to keep the buffer available after the browser has displayed the
* buffer (at the cost of increased memory use).
* @default false

@@ -114,13 +71,23 @@ */

/**
* If set to true, this hints to the user agent (browser) to use a compatible graphics
* adapter for an immersive XR device. Setting this synchronous flag at context creation
* is discouraged; rather call the asynchronous WebGLRenderingContext.makeXRCompatible()
* method the moment you intend to start an XR session.
* @public
* @readonly
* @type {boolean}
* Stenciling enables and disables drawing on a per-pixel basis. It is
* typically used in multipass rendering to achieve special effects.
* @default false
*/
readonly stencil?: boolean;
/**
* If set to true, the context will have an 8 bit stencil buffer. Defaults to
* false. Use gl.enable(STENCIL_TEST) to enable depth test and
* gl.stencilFunc(), gl.stencilFuncSeparate(), gl.stencilMask(),
* gl.stencilMaskSeparate(), gl.stencilOp(), and gl.stencilOpSeparate()
* to configure the stencil test.
* @default false
*/
readonly desynchronized?: boolean;
/**
* xrCompatible is a boolean that indicates whether the context is compatible.
* @default false
*/
readonly xrCompatible?: boolean;
}
export type { IWebGLContextAttributes };
//# sourceMappingURL=webgl-context-attributes.d.ts.map
{
"name": "react-unity-webgl",
"version": "8.8.0",
"description": "React Unity WebGL provides an easy solution for embedding Unity WebGL builds in your React application, with two-way communication between your React and Unity application with advanced API's.",
"version": "9.0.0",
"description": "React Unity WebGL provides a modern solution for embedding Unity WebGL builds in your React Application while providing advanced APIs for two way communication and interaction between Unity and React.",
"keywords": [

@@ -10,3 +10,3 @@ "React",

],
"homepage": "https://github.com/jeffreylanters/react-unity-webgl#readme",
"homepage": "https://react-unity-webgl.dev",
"bugs": {

@@ -32,4 +32,4 @@ "url": "https://github.com/jeffreylanters/react-unity-webgl/issues",

],
"main": "./distribution/index.js",
"types": "./distribution/index.d.ts",
"main": "/distribution/exports.js",
"types": "/distribution/exports.d.ts",
"browserslist": {

@@ -53,9 +53,8 @@ "production": [

"start": "tsc --watch",
"test": "echo 'Please use the test environment'",
"compile": "tsc",
"package": "npm pack",
"generate-gh-pages": "rm -rf ./gh-pages && cp -r ./documentation ./gh-pages && node ./scripts/generate-markdown.js"
"lint": "echo 'Warning: lint is not implemented yet'"
},
"devDependencies": {
"@types/react": "17.0.39",
"@types/react": "17.0.41",
"typescript": "4.5.4"

@@ -62,0 +61,0 @@ },

@@ -1,2 +0,2 @@

import { IUnityInstanceParameters } from "../source/interfaces/unity-instance-parameters";
import { IUnityArguments } from "../source/interfaces/unity-arguments";

@@ -8,13 +8,10 @@ /**

/**
* Object containing all registered legacy unity event listeners.
* @deprecated
*/
var ReactUnityWebGL: {
[eventName: string]: Function;
};
/**
* Dispatches an event that has been registered to all event systems.
* @param eventName The name of the event.
* @param parameters The parameters to pass to the event.
*/
var dispatchReactUnityEvent: Function;
function dispatchReactUnityEvent(
eventName: string,
...parameters: ReactUnityEventParameterType[]
): void;

@@ -24,3 +21,3 @@ /**

* @param canvasHtmlElement The target html canvas element.
* @param parameters The paramters needed to load Unity.
* @param arguments The arguments needed to load Unity.
* @param onProgress The on progress event listener.

@@ -31,5 +28,28 @@ * @returns A promise resolving when instantiated successfully.

canvasHtmlElement: HTMLCanvasElement,
parameters: IUnityInstanceParameters,
arguments: IUnityArguments,
onProgress?: (progression: number) => void
): Promise<UnityInstance>;
/**
* Due to some developers wanting to use the window object as a global scope
* in order to invoke the create Unity Instance and dispatch React Unity Event
* functions, we need to declare the window object as a global type.
*/
interface Window {
/**
* Dispatches an event that has been registered to all event systems.
* @param eventName The name of the event.
* @param parameters The parameters to pass to the event.
*/
dispatchReactUnityEvent: typeof dispatchReactUnityEvent;
/**
* Creates a new UnityInstance.
* @param canvasHtmlElement The target html canvas element.
* @param arguments The arguments needed to load Unity.
* @param onProgress The on progress event listener.
* @returns A promise resolving when instantiated successfully.
*/
createUnityInstance: typeof createUnityInstance;
}
}

@@ -5,2 +5,5 @@ /**

declare class UnityInstance {
/**
* Creates a new instance of Unity Instance.
*/
constructor();

@@ -10,3 +13,2 @@

* Sends a message to the UnityInstance to invoke a public method.
* @public
* @param gameObjectName the name of the game object in your Unity scene.

@@ -19,3 +21,3 @@ * @param methodName the name of the public method on the game object.

methodName: string,
parameter?: string | number | boolean
parameter?: ReactUnityEventParameterType
): void;

@@ -25,14 +27,21 @@

* Enables or disabled the fullscreen mode of the UnityInstance.
* @public
* @param fullScreen sets the fullscreen mode.
*/
public SetFullscreen(fullScreen: number): void;
public SetFullscreen(fullScreen: 0 | 1): void;
/**
* Quits the Unity WebGL application
* and removes it from the memory.
* @public
* @returns {Promise<void>} a promise whether the application did quit.
* Quits the Unity WebGL application and removes it from the memory.
* @returns a promise which resolves when the application did quit.
*/
public Quit(): Promise<void>;
/**
* The Unity Module.
*/
public Module: {
/**
* A reference to the Unity Instance's Canvas.
*/
canvas?: HTMLCanvasElement;
};
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc