Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  3. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Uncaught ReferenceError: Runtime is not defined when .jslib referring to it

Discussion in '2021.2 Beta' started by xuan_celestial, Aug 5, 2021.

  1. xuan_celestial

    xuan_celestial

    Joined:
    Jul 17, 2018
    Posts:
    18
    kou-yeung/WebGLInput: IME for Unity WebGL (github.com)

    All the while I using the plugin above to support WebGL mobile input, which pop up a keyboard. Previously the Unity Version I using was Unity 2020.3.12f1 LTS and this issue never happen.

    Mainly it was these line in the .jslib plugin that throw the error:

    Runtime.dynCall();


    I not sure this is Unity issue or the plugin issue so I'm trying my luck here.

    So far this issue occurs in 2021.2.b4 & 2021.2.b6
     
  2. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
  3. Iggy101

    Iggy101

    Joined:
    May 29, 2013
    Posts:
    1
    Is there a way to bypass this issue in 2021.2.b6 until a fix is available? Like a way to disable the incremental builder? I'm fine with dirty hacks :)

    I'm hoping to use some features in beta but can't proceed until I can build with .jslib plugins
     
  4. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
    Workaround would be to move the file out of the package and into Assets.

    The fix didn't make it into b7 so b8 looks likely at this point.
     
  5. kou-yeung

    kou-yeung

    Joined:
    Sep 5, 2016
    Posts:
    32
  6. markaldo1

    markaldo1

    Joined:
    Feb 28, 2022
    Posts:
    2
    If you are using any script file and getting "Uncaught ReferenceError: x is not defined " which means ‘x’ is either a variable or a method which you are trying to use before declaring it using var keyword. This means that there is a non-existent variable referenced somewhere. This variable needs to be declared, or you need to make sure it is available in your current script or scope otherwise , it will endup throwing this ‘x’ is not defined error . This usually indicates that your library is not loaded and JavaScript does not recognize the ‘x’.

    To solve this error: Load your library at the beginning of all your scripts.

    There can be multiple other reasons for this issue:

    • Conflict with Other Libraries
    • Path to your library included is not correct
    • Llibrary file is corrupted
    • Working offline (when you use CDN)
     
  7. jdsjsj

    jdsjsj

    Joined:
    Aug 8, 2019
    Posts:
    2
    i use 2022.1.0b9 of unity, still has this problem and i have other problem
    upload_2022-3-2_11-6-26.png
    i dont know why, i use python build a server, when i use 2020,it can work,
    upload_2022-3-2_11-7-48.png
    this is python code, webgl is important for me, so you can fixed these problems as soon as? i feel webgl is a orphan
     

    Attached Files:

  8. jdsjsj

    jdsjsj

    Joined:
    Aug 8, 2019
    Posts:
    2
    upload_2022-3-2_11-43-53.png
    this is start error