Uncaught TypeError: Cannot read property 'length' of undefined UnityLoader.js:1

I receive the following error when I implement the webgl export on my website:

UnityLoader.js:1 Invoking error handler due to
Uncaught TypeError: Cannot read property ‘length’ of undefined

UnityLoader.js:1 Uncaught TypeError: Cannot read property ‘length’ of undefined
at Object.md5 (UnityLoader.js:1)
at Object.loadCode (UnityLoader.js:1)
at processAsmCodeJob (UnityLoader.js:1)
at a.callback (UnityLoader.js:1)

on this site: Typing Test - 10FastFingers.com

However, if I implement the same code on another website, it works without any issues:
http://simpleplaystudio.com/10ffmp

My setup

  • Unity 5.6.0f3
  • Win 10 - 64 bit
  • chrome Version 58.0.3029.96 (64-bit), Firefox 53.0 (32-Bit)

Build Settings

(same issue with and without webassembly activated)

Any clue what might cause this?

This time I ran the Development Build version and received the following error:

Is it possible that the errors have something to do with my site being on https?
I just created a completely empty webgl project and received the same error as I got in the first post.
You can test it out yourself here: Empty10FastFingers.com

Just tested the empty project on a different domain with https and the project runs without a problem.

My site runs on AWS, might this be the reason I see these errors? At the moment I don’t have the files in an S3 bucket, I read somewhere that this might fix some webgl issues.

After adding the files to an S3 bucket, everything works fine!

I’ve been trying to build a Polymer based web-component to load Unity WebGL content - and keep hitting this problem, both locally with polymer --server and when bundled and uploaded to Firebase for hosting.

In fact the web-component works fine when using the polymer demo code, but fails when it’s added to a project (I’m pretty sure my paths are all correct).

My repo is davie-robertson/unity-webgl (all WIP- until I can get this fixed)

Can anyone help with the root cause?

EDIT: FIXED it was looking for an entry in the .json file of the webgl build content called:

"graphicsAPI": ["WebGL 2.0", "WebGL 1.0"],

I was using a newer version of unityloader.js with an older .JSON file that didn’t have this entry

Plsssss help me. Is your repo updated? I’m trying to create a element with the webgl content for about a week and had no success. I cloned your repo but it seems it is missing files. Can you give me some tips on how to do it?

EDIT: Well I found another repo from you. You made it happen with polymer 2 and based on what you did I was able to do it with polymer 3. Thanks man

What files are you talking about? Can you please explain in more detail the set up you had before and after it worked? Thank you @christianstrang