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

How to call functions in C# from .js or .jslib files in Tiny?

Discussion in 'Project Tiny' started by brunocoimbra, Feb 26, 2020.

  1. brunocoimbra

    brunocoimbra

    Joined:
    Sep 2, 2015
    Posts:
    679
    Hi,

    I am trying to get some JavaScript code to work with Tiny, but I keep getting the following error:

    Build Wasm failed in BuildStepRunBee after 1.15m.
    emcc:WARNING: for wasm there is no need to set ELIMINATE_DUPLICATE_FUNCTIONS, the binaryen optimizer does it automatically

    error: undefined symbol: MultiplyNumbers
    warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
    Error: Aborting compilation due to previous errors
    shared:ERROR:


    My js file and my test c# class is the same one from here: https://forum.unity.com/threads/call-c-from-javascript-in-tiny.800340/#post-5405385

    The only difference is that both are in the same folder as my root assembly (as another replier in that thread mentioned to do).

    @tonialatalo @ckucukha sorry for mentioning you both, but saw that you got that working, any advice here?
     
  2. elliotc-unity

    elliotc-unity

    Unity Technologies

    Joined:
    Nov 5, 2015
    Posts:
    230
    To clarify, the js file needs to be in a `js~` directory, and said directory needs to be next to an asmdef compiled in the build. From your post I'm guessing the js file itself is next to an asmdef, which would not work.
     
    brunocoimbra likes this.
  3. brunocoimbra

    brunocoimbra

    Joined:
    Sep 2, 2015
    Posts:
    679
    Thank you very much! It is working now!!
     
    tonialatalo and elliotc-unity like this.