private void OnScriptRuntimeInitialized(ScriptRuntime runtime) { var tsconfig = GetTSConfig(); if (tsconfig != null) { runtime.AddSearchPath(tsconfig.compilerOptions.outDir); } runtime.EvalMain(_prefs.editorEntryPoint); foreach (var module in _prefs.editorRequires) { runtime.ResolveModule(module); } var editorScripts = new List <JSScriptClassPathHint>(); JSScriptFinder.GetInstance().ModuleSourceChanged += OnModuleSourceChanged; JSScriptFinder.GetInstance().Search(JSScriptClassType.Editor, editorScripts); foreach (var editorScript in editorScripts) { runtime.ResolveModule(editorScript.modulePath); } }
private void OnModuleSourceChanged(string modulePath, JSScriptClassType classTypes) { if ((classTypes & JSScriptClassType.Editor) != 0) { if (_runtime != null && _runtime.isValid && !EditorApplication.isCompiling) { _runtime.ResolveModule(modulePath); } } }