Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Want to know the principle of converting C# to WebAssembly?

Discussion in 'Project Tiny' started by silveryw, Oct 9, 2019.

  1. silveryw

    silveryw

    Joined:
    Sep 21, 2014
    Posts:
    12
    Blazor? Mono wasm?
     
  2. kevinmv

    kevinmv

    Unity Technologies

    Joined:
    Nov 15, 2018
    Posts:
    51
    Broadly speaking, the build pipeline to output WebAssembly used today is,
    c# source files → Rosyln c# compiler→ IL2cpp emscripten → WASM/ASMJS output files.

    Hope this helps,
    Kev
     
    Antypodish likes this.
  3. egonaraujo

    egonaraujo

    Joined:
    Jan 21, 2015
    Posts:
    18
    Is it possible to control the emscripten configuration?
    My idea is to add/change some lines so I would be able to call JS functions from my C#..
    Maybe I could have some headers that both C# and emscripen will look for when building the end file...
     
  4. silveryw

    silveryw

    Joined:
    Sep 21, 2014
    Posts:
    12
    Thank you, I thought it was:
    c# source files → Mono → LLVM IR → emscripten → WASM/ASMJS
     
  5. yossi_horowitz_artie

    yossi_horowitz_artie

    Joined:
    Jan 30, 2019
    Posts:
    87
    One of the sample projects that comes with Tiny (as well as the source for the Tiny engine itself) show calls from C# code to both Javascript and C++.
     
    egonaraujo likes this.