1
1
using System . Collections ;
2
2
using System . IO ;
3
+
3
4
using Unity . EditorCoroutines . Editor ;
4
5
using UnityEditor ;
5
6
using UnityEngine ;
@@ -91,15 +92,15 @@ private static void ManageSceneViewCore(IToolboxSceneViewSettings settings)
91
92
92
93
private static string GetSettingsFileGuid ( )
93
94
{
94
- var guids = AssetDatabase . FindAssets ( "t:" + settingsType ) ;
95
+ var guids = AssetDatabase . FindAssets ( $ "t:{ settingsType } " ) ;
95
96
string targetGuid = null ;
96
97
//try to find a settings file in a non-package directory
97
98
for ( var i = guids . Length - 1 ; i >= 0 ; i -- )
98
99
{
99
100
var guid = guids [ i ] ;
100
101
var path = AssetDatabase . GUIDToAssetPath ( guid ) ;
101
102
targetGuid = guid ;
102
- if ( path . StartsWith ( "Assets" ) )
103
+ if ( ! IsDefaultSettingsPath ( path ) )
103
104
{
104
105
break ;
105
106
}
@@ -108,6 +109,11 @@ private static string GetSettingsFileGuid()
108
109
return targetGuid ;
109
110
}
110
111
112
+ private static bool IsDefaultSettingsPath ( string path )
113
+ {
114
+ return path . StartsWith ( "Packages" ) ;
115
+ }
116
+
111
117
[ InitializeOnLoadMethod ]
112
118
internal static void InitializeToolbox ( )
113
119
{
@@ -223,7 +229,7 @@ void ReintializeProvider()
223
229
AssetDatabase . SaveAssets ( ) ;
224
230
AssetDatabase . Refresh ( ) ;
225
231
226
- ToolboxEditorLog . LogInfo ( "Created a settings file at - " + relativePath ) ;
232
+ ToolboxEditorLog . LogInfo ( $ "Created a settings file at - { relativePath } " ) ;
227
233
228
234
ReintializeProvider ( ) ;
229
235
}
@@ -232,7 +238,13 @@ void ReintializeProvider()
232
238
}
233
239
234
240
EditorGUILayout . Space ( ) ;
235
- EditorGUILayout . LabelField ( "Settings file location - " + SettingsPath ) ;
241
+ EditorGUILayout . LabelField ( $ "Settings file location - { SettingsPath } ") ;
242
+ if ( IsDefaultSettingsPath ( SettingsPath ) )
243
+ {
244
+ EditorGUILayout . HelpBox ( "The currently displayed settings file is the default one, located in the packages directory. " +
245
+ "This means all changes can be easily lost. Create a new file for better maintainability." , MessageType . Info ) ;
246
+ }
247
+
236
248
EditorGUILayout . Space ( ) ;
237
249
238
250
globalSettingsEditor . OnInspectorGUI ( ) ;
0 commit comments