CanvasJSSDKBindings bug fix to allow Unity project development build to succeed#311
CanvasJSSDKBindings bug fix to allow Unity project development build to succeed#311gnoph wants to merge 1 commit intofacebook:mainfrom
Conversation
|
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
|
Apparently Unity has two sets of mergeInto and autoAddDeps methods. One from emscripten (found in utility.js and library.js), the other is provided by Unity (DynamicJsLibLoader.js). Unity version: The Unity version is used when "use pre-built engine" is checked (or when development build is enabled as well?). With the emscripten version, it's OK to call autoAddDeps with LibraryManager.library as the first parameter. It will however cause the dependencies being added to all javascript functions from all js libraries. According to emscripten (https://emscripten.org/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html), the first parameter for autoAddDeps is "myLibrary", which in this case should be |

The original line translates to
Module["FBUnity"] = LibraryManager.library.$FBUnityWhich is apparently wrong. $FBUnity is a member of FBUnityLib. It should be
Module["FBUnity"] = FBUnityLib.$FBUnityThat is, the first parameter for autoAddDeps should be
FBUnityLib. Function autoAddDeps is defined in DynamicJslibLoader.js found under Unity's WebGL playback engine.Without the fix, a development build for a Unity project with this library will fail with "Unresolved symbol: rand". Release build does work. I'm not sure why.