Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

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

Discussion in 'WebGL' started by christianstrang, May 12, 2017.

  1. christianstrang

    christianstrang

    Joined:
    Aug 6, 2013
    Posts:
    29
    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: https://10fastfingers.com/pages/test

    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?
     
  2. christianstrang

    christianstrang

    Joined:
    Aug 6, 2013
    Posts:
    29
    This time I ran the Development Build version and received the following error:

     
  3. christianstrang

    christianstrang

    Joined:
    Aug 6, 2013
    Posts:
    29
    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: https://10fastfingers.com/pages/empty
     
  4. christianstrang

    christianstrang

    Joined:
    Aug 6, 2013
    Posts:
    29
    Just tested the empty project on a different domain with https and the project runs without a problem.
     
  5. christianstrang

    christianstrang

    Joined:
    Aug 6, 2013
    Posts:
    29
    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.
     
  6. christianstrang

    christianstrang

    Joined:
    Aug 6, 2013
    Posts:
    29
    After adding the files to an S3 bucket, everything works fine!
     
  7. anastrophe

    anastrophe

    Joined:
    Feb 8, 2017
    Posts:
    9
    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
     
    Last edited: Mar 21, 2018
  8. DanielSafs

    DanielSafs

    Joined:
    Nov 22, 2016
    Posts:
    11

    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
     
    Last edited: Jan 15, 2019
  9. pmadrid

    pmadrid

    Joined:
    Apr 8, 2019
    Posts:
    2
    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 @simpleplaystudio