De-Panther / unity-webxr-export

Develop and export WebXR experiences using Unity WebGL
https://de-panther.github.io/unity-webxr-export/
Apache License 2.0
1.04k stars 110 forks source link

Display AR and VR buttons in Unity Canvas #372

Closed ragson closed 5 months ago

ragson commented 5 months ago

Hi,

I would like to know how to show AR and VR buttons in Unity canvas from the WebGL page which are displaying in the bottom as default? Could you please help me on this solution.

Regards Kiran.

De-Panther commented 5 months ago

Not sure what you are asking. If it's how to enter AR/VR session from C# code, There's WebXRManager.ToggleAR and WebXRManager.ToggleVR. You can check if the user is in non-XR mode, AR mode or VR mode using WebXRManager.XRState‎ and WebXRManager.OnXRChange.

ragson commented 5 months ago
image

Hi, i unable to access the WebXRManager script getting compile error can you check the reference image where i missed?

De-Panther commented 5 months ago

You need to use assembly definition (asmdef), and reference the WebXR asmdef file. https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html

ragson commented 5 months ago

Thank you, Its working.