public static void OpenSourceCode(this ShaderBuildReport.GPUProgram program) { if (program != null && !string.IsNullOrEmpty(program.sourceCode)) { var fileInfo = program.CreateTemporarySourceCodeFile(); Application.OpenURL(fileInfo.FullName); } }
public static FileInfo CreateTemporarySourceCodeFile(this ShaderBuildReport.GPUProgram program) { var path = FileUtil.GetUniqueTempPathInProject(); var fileInfo = new FileInfo(string.Format("{0}-{1}.{2}", path, program.name, "hlsl")); if (!fileInfo.Directory.Exists) { fileInfo.Directory.Create(); } File.WriteAllText(fileInfo.FullName, program.sourceCode); return(fileInfo); }