Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

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:
    5
    Blazor? Mono wasm?
     
  2. kevinmv

    kevinmv

    Unity Technologies

    Joined:
    Nov 15, 2018
    Posts:
    5
    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:
    11
    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:
    5
    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:
    63
    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.