void InitializeJsEditor() { if (isEditorReady) { return; } browser.CheckIsReadyAsync(value => { if ((bool)value) { isEditorReady = true; // Load all typings foreach (var entry in behaviorSystem.typings) { string path = entry.GetAbsolute(); if (!System.IO.File.Exists(path)) { Debug.LogError($"Bad typings path: {path}"); } else { string contents = System.IO.File.ReadAllText(path); browser.AddSystemSource(contents, System.IO.Path.GetFileName(path)); } } int count = 0; foreach (TextAsset jsSource in behaviorSystem.ForSystemSources()) { // Only include the ones marked as visible to Monaco. if (jsSource.text.Contains("// VISIBLE_TO_MONACO")) { browser.AddSystemSource(jsSource.text, $"voos_{count++}-{jsSource.name}.js"); } } } else { // Call again. InitializeJsEditor(); } }); }