Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by alexnaraghi · Feb 27, 2016 at 03:41 PM · webgldebugging

Can Unity export the Emscripten symbols map on WebGL builds?

I am looking to get a stack trace on crashes for minified RELEASE builds in WebGL, and believe we can do this using the standard Emscripten output, as we have done it on another project that uses Emscripten. I know that you can get a readable stack trace on DEBUG builds because of the following:

When you tick the “Development Build” checkbox, Unity will generate a development build (with Profiler support and the development console for errors, like on other platforms). Additionally, Development builds are non-minified, so the generated JavaScript is human-readable and preserves function names (so you will get useful stack traces for errors), but very large to distribute.

http://docs.unity3d.com/Manual/webgl-building.html

What we need is a specific symbol to be added to the build args for emscripten, --emit-symbol-map, so that the file is outputted in the build. From the emscripten docs:

--emit-symbol-map: Save a map file between the minified global names and the original function names. This allows you, for example, to reconstruct meaningful stack traces.

https://kripken.github.io/emscripten-site/docs/tools_reference/emcc.html

That is the file we get on our other project where we can see the symbols map.

Unity seems to have its own method of passing arguments to emscripten. For example, when you select the "Optimizations Level" in the WebGL settings, it modifies an entry to the projectsettings.asset. At compile time, that entry is mapped to the optimization argument passed into emscripten, for example, "Fast Builds" in Unity maps to -O0: no optimizations. One of the others maps to -O2: various JavaScript-level optimizations and LLVM -03 optimizations.

The problem is, as far as I know, there isn't a place where we can inject custom args into the emscripten execution. We need this argument to be passed to emscripten, and the resulting .symbols file to end up in the build output folder. Then we can read the Javascript stack trace, hand-map it to the cpp stack trace, and finally to our C# code, which will be very useful for crash debugging.

Can this be done in Unity as is?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Marco-Trivellato · May 03, 2016 at 10:11 AM

In Unity 5.4+, we internally pass --emit-symbol-map to emcc.

In Unity 5.0-5.3, we don't but you can do that via editor scripting:

 PlayerSettings.SetPropertyString("emscriptenArgs", "--emit-symbol-map");

hope that helps!

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Gaudon · May 03, 2016 at 12:46 PM 0
Share

Is it possible to have unity tell emscipten to compile for WebAssembly as in this post: https://hacks.mozilla.org/2015/12/compiling-to-webassembly-its-happening/

 emcc file.cpp -o file.js -s ‘BINARYEN=”path-to-binaryen”’


avatar image monark · Aug 17, 2018 at 08:48 AM 0
Share

$$anonymous$$arked as obsolete in 2017.4, how do we do this now?

avatar image
0

Answer by DAVco · Oct 05, 2018 at 09:52 AM

Just to update the answer for Unity 2017+

PlayerSettings.SetPropertyString is deprecated and we should use the following instead:

 PlayerSettings.WebGL.emscriptenArgs = "your args"
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

WebGL Lags and Arrow Keys do not work 0 Answers

How to use Webgl Debug Symbols? 0 Answers

How do you show C# line numbers in a WebGL build's stack trace? 1 Answer

How do you do repeated "Build & Run" builds with WebGL without recompiling? 0 Answers

How to debug a maximum call stack size error in WebGL? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges