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.5.0 to 8.5.1

distribution/interfaces/webgl-context-attributes.d.ts

3

distribution/components/unity.js

@@ -160,2 +160,5 @@ "use strict";

_unityInstanceParameters.devicePixelRatio = this.props.devicePixelRatio;
if (this.unityContext.unityConfig.webglContextAttributes !== undefined)
_unityInstanceParameters.webglContextAttributes =
this.unityContext.unityConfig.webglContextAttributes;
if (this.props.matchWebGLToCanvasSize !== undefined)

@@ -162,0 +165,0 @@ _unityInstanceParameters.matchWebGLToCanvasSize =

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

import { IWebGLContextAttributes } from "./webgl-context-attributes";
export interface IUnityConfig {

@@ -55,3 +56,11 @@ /**

productVersion?: string;
/**
* This object allow you to configure WebGLRenderingContext creation options
* which will be pass additional context attributes to the Unity canvas.
* @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext
* @public
* @type {IWebGLContextAttributes}
*/
webglContextAttributes?: IWebGLContextAttributes;
}
//# sourceMappingURL=unity-config.d.ts.map

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

import { IWebGLContextAttributes } from "./webgl-context-attributes";
export interface IUnityInstanceParameters {

@@ -68,2 +69,10 @@ /**

/**
* This object allow you to configure WebGLRenderingContext creation options
* which will be pass additional context attributes to the Unity canvas.
* @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext
* @public
* @type {IWebGLContextAttributes}
*/
webglContextAttributes?: IWebGLContextAttributes;
/**
* When assigned this method will intercept all incomming messages from the

@@ -70,0 +79,0 @@ * Unity Module into the console. These messages will contain both of the

2

package.json
{
"name": "react-unity-webgl",
"version": "8.5.0",
"version": "8.5.1",
"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.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -59,2 +59,3 @@ <div align="center">

- [Defining the Streaming Assets URL](#defining-the-streaming-assets-url)
- [Configuring the WebGL Rendering Context](#configuring-the-webgl-rendering-context)
- [Providing Application Meta Data](#providing-application-meta-data)

@@ -788,2 +789,59 @@ - [Getting a Reference to the Unity Canvas](#getting-a-reference-to-the-unity-canvas)

## Configuring the WebGL Rendering Context
> Available since version 8.5.0
The WebGLContexAttributes allow you to configure WebGLRenderingContext creation options when passed as an additional context attributes parameter to the UnityContext. An object can be used as the WebGLContextAttributes and if the properties below are specified on it, they will be used instead of the default values. Only the options passed to the first call will apply, subsequent calls will ignore the attributes.
```tsx
<IUnityConfig>{
webGLContextAttributes: {
alpha: boolean,
antialias: boolean,
depth: boolean,
failIfMajorPerformanceCaveat: boolean,
powerPreference: "default" | "high-performance" | "low-power",
premultipliedAlpha: boolean,
preserveDrawingBuffer: boolean,
stencil: boolean,
desynchronized: boolean,
xrCompatible: boolean,
},
};
```
#### Example implementation
A basic implementation could look something like this.
```jsx
// File: App.jsx
import React from "react";
import Unity, { UnityContext } from "react-unity-webgl";
const unityContext = new UnityContext({
loaderUrl: "build/myunityapp.loader.js",
dataUrl: "build/myunityapp.data",
frameworkUrl: "build/myunityapp.framework.js",
codeUrl: "build/myunityapp.wasm",
webGLContextAttributes: {
alpha: true,
antialias: true,
depth: true,
failIfMajorPerformanceCaveat: true,
powerPreference: "high-performance",
premultipliedAlpha: true,
preserveDrawingBuffer: true,
stencil: true,
desynchronized: true,
xrCompatible: true,
},
});
function App() {
return <Unity unityContext={unityContext} />;
}
```
## Providing Application Meta Data

@@ -790,0 +848,0 @@

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