Skip to content

Commit 834644c

Browse files
authored
Merge pull request #7 from VRLabs/1.0-updates
Use last generated shader path as default path
2 parents 64bef0a + c88fd7c commit 834644c

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

Editor/Editors/Inspectors/ModularShaderEditor.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.IO;
23
using UnityEditor;
34
using UnityEngine;
45
using UnityEngine.UIElements;
@@ -57,10 +58,20 @@ public override VisualElement CreateInspectorGUI()
5758
return;
5859
}
5960

60-
string path = EditorUtility.OpenFolderPanel("Select folder", "Assets", "");
61-
if (path.Length == 0)
62-
return;
61+
string path = "";
62+
if (_shader.LastGeneratedShaders != null &&_shader.LastGeneratedShaders.Count > 0 && _shader.LastGeneratedShaders[0] != null)
63+
{
64+
path = Path.GetDirectoryName(AssetDatabase.GetAssetPath(_shader.LastGeneratedShaders[0]));
65+
}
6366

67+
if (string.IsNullOrWhiteSpace(path))
68+
{
69+
70+
path = EditorUtility.OpenFolderPanel("Select folder", "Assets", "");
71+
if (string.IsNullOrWhiteSpace(path))
72+
return;
73+
74+
}
6475
string localPath = Environment.CurrentDirectory;
6576
localPath = localPath.Replace('\\', '/');
6677
path = path.Replace(localPath + "/", "");

0 commit comments

Comments
 (0)