Hello. Windows 8, Unity 5.4.0f3 Personal, trying to build for WebGL. My old method in Unity 4 was to build for the WebPlayer, then just name the resulting .html and .build files something descriptive and upload them to my server, making sure the .html correctly references the .build name. Now with this WebGL build though, I’ve uploaded the .html file and the Release and TemplateData directories, opened the .html file in Firefox, and I get: “Unknown compression method.”
After forum-surfing, I tried renaming “Build.datagz”, “Build.jsgz” and “Build.memgz” within the Release directory, to remove the final “gz” of each. This time, the Web browser displayed a loading bar, and then the following:
“Syntax Error: Illegal character.”
(in Javascript console:)
Warning: NetUtil.asyncFetch() requires the channel to have one of the security flags set in the loadinfo (see nsILoadInfo). Please create channel using NetUtil.newChannel()
Invoking error handler due to
SyntaxError: illegal character
UnityLoader.js:1:31118
SyntaxError: illegal character:1
This build of my game consists of only a single scene, containing a script that’s supposed to load a text file from the Resources directory:
public Text thingy;
void Start()
{
TextAsset t = (TextAsset) Resources.Load("test", typeof(TextAsset));
Debug.Log(t);
Debug.Log(t.text);
thingy.text = t.text;
}
When running that in the editor, or building for WebGL and loading the resulting build on my own computer, it works, loading the text file “test.txt” and displaying its contents. What is going wrong between there, and having the exact same build work on a Web server?
If at all possible I’d like to avoid having to reconfigure the Web server just to support the new Unity, since I don’t own or administer that server. Incidentally, is it normal for the WebGL build process to take 15 minutes or so and lock up the mouse cursor, vs. 2 minutes to build for WebPlayer in Unity 4?