Skip to content

Setting WebGLContextAttributes doesn't seem to have any effect #514

Open
@Kottakji

Description

@Kottakji

Please avoid duplicates

Language and Compiler

Babel and WebPack JavaScript

What environment are you using?

Static File Serving

When does your problem occur?

When the Unity App is running

What does your problem relate to?

The problem seems related to my project

React-Unity-WebGL Version

9.4.2

React Version

18.2.0

Unity Version

2021.1.25f1

What happened?

I'm creating my unity context as follows:

const {unityProvider, sendMessage, loadingProgression, isLoaded} = useUnityContext({
    loaderUrl: `build/${process.env.NEXT_PUBLIC_APP_NAME}.loader.js`,
    dataUrl: `build/${process.env.NEXT_PUBLIC_APP_NAME}.data.gz`,
    frameworkUrl: `build/${process.env.NEXT_PUBLIC_APP_NAME}.framework.js.gz`,
    codeUrl: `build/${process.env.NEXT_PUBLIC_APP_NAME}.wasm.gz`,
    webglContextAttributes: {
      alpha: true,
      antialias: true,
      depth: true,
      failIfMajorPerformanceCaveat: true,
      powerPreference: "high-performance",
      premultipliedAlpha: true,
      preserveDrawingBuffer: true,
      stencil: true,
      desynchronized: true,
      xrCompatible: true,
    },
  });

But when reading the WebGLContextAttributes from the browser (Chrome / Firefox) it doesn't appear to have changed.

document.getElementById("react-unity-webgl-canvas-1").getContext("webgl2").getContextAttributes(); 

image

Am I doing something wrong? Or is this an issue?

Reproducible test case

No response

Would you be interested in contributing a fix?

  • yes, I would like to contribute a fix

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions