// Immediately compile any files that aren't compiled and should be. static void EnsureInkIsCompiled() { var filesToRecompile = InkLibrary.GetFilesRequiringRecompile(); if (filesToRecompile.Any()) { if (InkSettings.instance.compileAllFilesAutomatically) { InkCompiler.CompileInk(filesToRecompile.ToArray(), true, null); } } }
// Prevent building if ink is currently compiling. // Ideally we'd force it to complete instantly. // It seems you can do this with WaitHandle.WaitAll but I'm out of my depth! // Info here - https://stackoverflow.com/questions/540078/wait-for-pooled-threads-to-complete static bool AssertNotCompiling() { if (InkCompiler.executingCompilationStack) { StringBuilder sb = new StringBuilder("Ink is currently compiling!"); var errorString = sb.ToString(); InkCompiler.SetBuildBlocked(); if (UnityEditor.EditorUtility.DisplayDialog("Ink Build Error!", errorString, "Ok")) { Debug.LogError(errorString); } return(false); } return(true); }