ialex32x / unity-jsb

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

Error when generating static files #58

Closed jo32 closed 3 years ago

jo32 commented 3 years ago

Code generated by "Generate Binding And Type Definition" like below has syntax error, it seems "``1.ReadOn" has something to do with regex matching.

image

ialex32x commented 3 years ago

I changed the way how unsupported types are eliminated in the binding process. The old way (matching type.FullName with prefix) has a huge impact on the time consumption. You can try to add this type into typeFullNameBlacklist in Prefs.cs.

PS: a js-bridge.json (Prefs.cs) config editor will be provided later to reduce the pain of filling these blacklist.

ialex32x commented 3 years ago

or remove this line bindingManager.ExportTypesInAssembly(typeof(Editor).Assembly, true, transform => transform.EditorRuntime()); in UnityEditorBinding.cs, and pick up every type manually for editor scripting.

filharvey commented 3 years ago

Another one when using unity 2020.13f1

This code gets generated

image

and code is not reconised.

filharvey commented 3 years ago

commenting out the function works, for running.

ialex32x commented 3 years ago

This type extension does not exist on my end, try to add it's type.FullName or namespace into blacklist in Prefs.cs, or modify it locally in js-bridge.json if you use a local copy of Prefs. I'll also push a submission adding SyntaxTree.VisualStudio.Unity.Messaging into namespaceBlacklist by default.

BTW, a simple prefs editor has been provided. If you can find this type's namespace SyntaxTree.VisualStudio.Unity.Messaging in the prefs editor, you can also add it into blacklist by click and saving.