File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Editor/Editors/Inspectors Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 1
1
using System ;
2
+ using System . IO ;
2
3
using UnityEditor ;
3
4
using UnityEngine ;
4
5
using UnityEngine . UIElements ;
@@ -57,10 +58,20 @@ public override VisualElement CreateInspectorGUI()
57
58
return ;
58
59
}
59
60
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
+ }
63
66
67
+ if ( string . IsNullOrWhiteSpace ( path ) )
68
+ {
69
+
70
+ path = EditorUtility . OpenFolderPanel ( "Select folder" , "Assets" , "" ) ;
71
+ if ( string . IsNullOrWhiteSpace ( path ) )
72
+ return ;
73
+
74
+ }
64
75
string localPath = Environment . CurrentDirectory ;
65
76
localPath = localPath . Replace ( '\\ ' , '/' ) ;
66
77
path = path . Replace ( localPath + "/" , "" ) ;
You can’t perform that action at this time.
0 commit comments