-
Notifications
You must be signed in to change notification settings - Fork 713
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a28b1c
commit be597aa
Showing
5 changed files
with
15 additions
and
65 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
#if UNITY_2018_1_OR_NEWER | ||
using System.IO; | ||
using UnityEditor.Experimental.AssetImporters; | ||
using UnityEngine; | ||
|
||
using Puerts; | ||
|
||
[ScriptedImporter(1, "cjs")] | ||
public class CJSImporter : ScriptedImporter | ||
{ | ||
public override void OnImportAsset(AssetImportContext ctx) | ||
{ | ||
TextAsset subAsset = new TextAsset( File.ReadAllText( ctx.assetPath ) ); | ||
TextAsset subAsset = new TextAsset(File.ReadAllText(ctx.assetPath)); | ||
ctx.AddObjectToAsset("text", subAsset); | ||
ctx.SetMainObject( subAsset ); | ||
ctx.SetMainObject(subAsset); | ||
|
||
JsEnv.ClearAllModuleCaches(); | ||
#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