I am a new developer of unity.
My purpose is to make a AR project published by WebGL.
My development environment is Macbook M1 Pro.
To make that, I create a new project with 3D template.
And, add a AR Session Origin, AR Session, AR Default Plane to hierarchy like a below picture.
AR Session Origin. contains these component like this.
And, the building setting is like this.
And Player Setting is like this. I just disable Auto Graphics API for WebGL 2.0.
After build, I use react-webgl-unity library to publish a web page.
With build files named build.data.unityweb, build.framework.js.unityweb, build.loader.js, build.wasm.unityweb, I configed App instance like this.
import { useRef } from "react";
import { Unity, useUnityContext } from "react-unity-webgl";
function UnityTest() {
const {
unityProvider,
isLoaded,
loadingProgression,
} = useUnityContext({
codeUrl: '/build/build.wasm.unityweb',
dataUrl: '/build/build.data.unityweb',
frameworkUrl: '/build/build.framework.js.unityweb',
loaderUrl: '/build/build.loader.js',
webglContextAttributes: {
preserveDrawingBuffer: true,
},
});
const loadingPercentage = Math.round(loadingProgression * 100);
const canvasRef = useRef<HTMLCanvasElement>(null);
return (
<div className="container">
{isLoaded === false && (
<div className="loading-overlay">
<p>Loading... ({loadingPercentage}%)</p>
</div>
)}
<Unity
className="unity"
unityProvider={unityProvider}
style={{ border: "1px solid red", height: 400, width: 500 }}
devicePixelRatio={window.devicePixelRatio}
ref={canvasRef}
/>
</div>
);
}
export { UnityTest };
With npm start command, the web page is published correctly. But, the unity dom is appeared black screen…
And the error message in console is this.
01a8c287-e29d-4dad-abdf-b57c2999a28c:3 No active UnityEngine.XR.ARSubsystems.XRSessionSubsystem is available. Please ensure that a valid loader configuration exists in the XR project settings.
_JS_Log_Dump @ 01a8c287-e29d-4dad-abdf-b57c2999a28c:3
01a8c287-e29d-4dad-abdf-b57c2999a28c:3 No active UnityEngine.XR.ARSubsystems.XRPlaneSubsystem is available. Please ensure that a valid loader configuration exists in the XR project settings.
_JS_Log_Dump @ 01a8c287-e29d-4dad-abdf-b57c2999a28c:3
01a8c287-e29d-4dad-abdf-b57c2999a28c:3 No active UnityEngine.XR.ARSubsystems.XRCameraSubsystem is available. Please ensure that a valid loader configuration exists in the XR project settings.
_JS_Log_Dump @ 01a8c287-e29d-4dad-abdf-b57c2999a28c:3
01a8c287-e29d-4dad-abdf-b57c2999a28c:3 No active UnityEngine.XR.XRInputSubsystem is available. Please ensure that a valid loader configuration exists in the XR project settings.
What should I do to watch a AR camera in web browser(chrome)??