예제 #1
0
 public static void OpenSourceCode(this ShaderBuildReport.GPUProgram program)
 {
     if (program != null && !string.IsNullOrEmpty(program.sourceCode))
     {
         var fileInfo = program.CreateTemporarySourceCodeFile();
         Application.OpenURL(fileInfo.FullName);
     }
 }
예제 #2
0
        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);
        }