Skip to content

Commit 624116e

Browse files
feat: use default WebGL context attributes if not provided in Unity props
1 parent 2c07567 commit 624116e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

module/source/components/unity.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { useCanvasIdentifier } from "../hooks/use-canvas-identifier";
1414
import { useUnityLoader } from "../hooks/use-unity-loader";
1515
import { UnityArguments } from "../types/unity-arguments";
1616
import { defaultCacheControl } from "../constants/default-cache-control";
17+
import { webglContextAttributes } from "../constants/default-webgl-context-attributes";
1718

1819
const Unity: ForwardRefExoticComponent<
1920
UnityProps & React.RefAttributes<HTMLCanvasElement>
@@ -109,7 +110,9 @@ const Unity: ForwardRefExoticComponent<
109110
symbolsUrl: props.unityProvider.symbolsUrl,
110111
streamingAssetsUrl: props.unityProvider.streamingAssetsUrl,
111112
devicePixelRatio: props.devicePixelRatio,
112-
webglContextAttributes: props.unityProvider.webglContextAttributes,
113+
webglContextAttributes:
114+
props.unityProvider.webglContextAttributes ??
115+
webglContextAttributes,
113116
cacheControl: props.unityProvider.cacheControl ?? defaultCacheControl,
114117
autoSyncPersistentDataPath:
115118
props.unityProvider.autoSyncPersistentDataPath,

0 commit comments

Comments
 (0)