-
Notifications
You must be signed in to change notification settings - Fork 718
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Have Unity auto import .cjs files as TextAssets. These files are recognized by IDEs as JavaScript files (for syntax highlighting and debugging), and can be used directly with NodeJS. * Update CJS module import logic, so debugger (in VSCode) correctly points to the file on disk and stops at correct lines. * Support clearing module cache * Auto clear JS module cache on .cjs file change to streamline debugging process. * Fix build v8 after Github Actions changed their environment. * Code review commit. * Force build and publish workflow to use Xcode12.0 too. The new tool chain builds for arm architecture, which breaks linker step. Will need to add steps for arm specifically in the future so Unity works on the new Macs. * Fix casing.
- Loading branch information
1 parent
89fdc60
commit e209cb0
Showing
8 changed files
with
90 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#if UNITY_2018_1_OR_NEWER | ||
using System.IO; | ||
using UnityEditor.Experimental.AssetImporters; | ||
using UnityEngine; | ||
|
||
[ScriptedImporter(1, "cjs")] | ||
public class CJSImporter : ScriptedImporter | ||
{ | ||
public override void OnImportAsset(AssetImportContext ctx) | ||
{ | ||
TextAsset subAsset = new TextAsset(File.ReadAllText(ctx.assetPath)); | ||
ctx.AddObjectToAsset("text", subAsset); | ||
ctx.SetMainObject(subAsset); | ||
|
||
#if ENABLE_CJS_AUTO_RELOAD | ||
Puerts.JsEnv.ClearAllModuleCaches(); | ||
#endif | ||
} | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters