private void Update() { if (_runner == null) { return; } if (!_runner.IsRunning()) { return; } _runner.ContinueRunning(); ForceEditorWindowUpdate(); if (!_runner.IsComplete()) { return; } if (ProjectTools.IsDebugging) { Debug.Log(EditorConstants.ValidationHasCompletedMessage); } ForceEditorWindowUpdate(); LogFileWriter.WriteLogs(_outputFilename, _selectedFileOutputFormat, _logCache); }
/// <summary> /// Runs validation against the project in <see cref="SceneValidationMode"/> /// <paramref name="validationMode"/> and writes the log file to a file with a custom name. /// </summary> /// <param name="validationMode">The <see cref="SceneValidationMode"/> the validation is run in.</param> /// <param name="fileOutputFormat">The <see cref="FileOutputFormat"/> the file will be written in, if any.</param> /// <param name="doValidateProjectAssets">True if project assets should be validated, false if not.</param> /// <param name="doValidateAcrossScenes">True if cross-scene validation should be performed.</param> /// <param name="fileName">A custom filename for the log results to be written to.</param> /// <returns></returns> public static Result RunValidation( SceneValidationMode validationMode, FileOutputFormat fileOutputFormat, bool doValidateProjectAssets, bool doValidateAcrossScenes, string fileName) { try { var logCache = new LogCache(); var assetValidationRunner = new AssetValidatorRunner(logCache, validationMode); if (doValidateProjectAssets) { assetValidationRunner.EnableProjectAssetValidation(); } if (doValidateAcrossScenes) { assetValidationRunner.EnableCrossSceneValidation(); } assetValidationRunner.Run(); var newFileName = string.IsNullOrEmpty(fileName) ? EditorConstants.DefaultLogFilename : fileName; LogFileWriter.WriteLogs(newFileName, fileOutputFormat, logCache); var result = new Result { isSuccessful = logCache.All(x => x.logType != LogType.Error) }; result.message = result.isSuccessful ? ValidationSuccessMessage : ValidationFailedMessage; return(result); } catch (Exception ex) { return(new Result { isSuccessful = false, message = string.Format(ValidationErrorFormat, ex) }); } }