Questions about exporting to webGL

Hello everyone!

I have a few questions about exporting to webGL maybe you can help me.

When exporting with Unity-web-player the structure was like this:

-index.html
-proyect.unity3d

We would divide the project in scenes:

-index.html
-scene1.unity3d
-scene2.unity3d
-scene3.unity3d
-scene4.unity3d

With WebGL the exported files look like this:
-index.html
-data
-fileloader.js
-UnityConfig.js
-UnityProgress.js
-proyect.data
-proyect.html.men
-proyect.js

-compressed

What I want to do is something similar to what we used to do with the webplayer. and to be able to choose scene 1 scene 2 or 3 but from the index.html while keeping the amount of files to a minimum.

-index.html
-data
-fileloader.js
-UnityConfig.js
-UnityProgress.js
-scena1.data
-scena1.html.men
-scena1.js
-scena2.data
-scena2.html.men
-scena2.js
-scena3.data
-scena3.html.men
-scena3.js
-compressed

Is this possible?

Can we separate the scene files from the 3d engine on compiled scenes?

I am also seeing a “compressed” folder, I read that it will be used by the server if it allows gzip compression. So do we need to change the path or extension or what? Or does it read the scenes directly from that folder with the same extensions?

Will there be an option to be able to detect if the client’s browser supports webgl and if not send them to a unitywebplayer page?

Eagerly awaiting your answers
Thank you very much

I think the best way to do this would be to put your levels into AssetBundles, and then have a loader scene to let you pick and load the asset bundles.

If you are running Apache, you should not need to setup anything, as the provided .htacess file will tell the server to serve the corresponding files from the Compressed folder for the Data folder, so just uploading both should be fine. For other web servers you need to check your servers documentation on how to set this up.

This should be easy to achive by modifying the UnityConfig.js script, which handles WebGL detection.

2 Likes

The dynamic fonts are not supported in the export WebGL ?

Dynamic font are supported. But you will need to include the font data for any font you need, as WebGL has no way to access the ttf files of fonts installed on the users system.