MozillaReality / unity-webxr-export

INACTIVE - Assets for creating WebXR-enabled Unity3D projects.
https://mixedreality.mozilla.org/unity-webxr-export/Build/
Apache License 2.0
626 stars 127 forks source link

Custom WebGLTemplates #386

Closed De-Panther closed 4 months ago

De-Panther commented 4 years ago

The current WebXR WebGLTemplate is very "hardcoded" and it won't be so easy to customize it. There are buttons and other DOM elements that it looks for in the HTML page. Each template should contain important files like the webxr.js, gl-matrix-min.js and webxr-polyfill.js.

Unity doesn't support placement of the WebGLTemplates folder in sub folders, so all the templates must be located under Assets/WebGLTemplates.

The current way of using customize template for your own project, would be to copy the WebXR template and edit it. It means duplicated code in the project (the important JS files), and hard to maintain code over time - each update of the WebXR Export plugin would need to re edit the template and copy the updated files.

Possible solutions:

Then, there are a few options regarding the important JS files:

What do you think? Any other solutions?

uecarlos commented 4 years ago

Since the topic has been raised I'd like to nitpick regarding the inconvenience that the template files are processed by Unity (because they are required to be in the Assets folder). This creates .meta files that are not required and triggeres reimporting when working on the WebGL template.

In my fork I have renamed the template to "WebGL~" to prevent Unity from importing and watching those files.

I think this would solve the issue with the ".js" files in the project, since Unity would not care about them.

De-Panther commented 4 years ago

Good point regarding the tilde "~", but I'm not sure if files in that folder would be able to get into the unitypackage file. (supporting Unity Package Manager is another discussion)

When I'm working on the JS and HTML files, I work on the build folder, then I don't need to build again the project just to test those. I do need to remember and not accidentally build the project and erase my work.