ialex32x / unity-jsb

It brings Javascript runtime capability to Unity3D by integrating QuickJS.
MIT License
337 stars 41 forks source link

MacOS - building for distribution #46

Closed jeremywho closed 3 years ago

jeremywho commented 3 years ago

I'm trying to figure out if there's already a way to build for Mac that will include the .js files?

For development, things are getting loaded from the out folder, but this won't work for a standalone app.

It looks like webpack is setup to build things to the .dist folder and then maybe the Sample.cs file can be updated to use those resources?

Thank-you very much for this project, its very cool!

ialex32x commented 3 years ago

It's not implemented in this project. In general, the file system layer will be implemented by the game/app project. In Unity, you may write a file system layer with Unity Assetbundle, Unity Resources or any kind of archived file format as underlying facility. For shipping, the js files can be packaged by gulp/webpack/etc. In the example, js files are compiled and moved to Resources directory after being renamed with .txt suffix. Then a simple file system layer for Unity Resources is used to access the js files. BTW, it's OK to use a plain file system accessing real files if you don't care about the basic security of scripts (or just open to the end-user).

jeremywho commented 3 years ago

For shipping, the js files can be packaged by gulp/webpack/etc. In the example, js files are compiled and moved to Resources directory after being renamed with .txt suffix. Then a simple file system layer for Unity Resources is used to access the js files.

This is what I suspected.

Thank-you very much for the response!