1- using UnityEditor ;
1+ using System . IO ;
2+ using UnityEditor ;
23using UnityEngine ;
34
45namespace Toolbox . Editor
@@ -36,8 +37,6 @@ private static void ManageProjectCore(IToolboxProjectSettings settings)
3637 return ;
3738 }
3839
39- var validateData = ! IsInitialized ;
40-
4140 //enable/disable the core GUI function
4241 ToolboxEditorProject . IsOverlayAllowed = settings . UseToolboxProject ;
4342
@@ -160,15 +159,15 @@ void ReintializeProvider()
160159
161160 //rebuild the settings provider right after initialization
162161 provider . OnDeactivate ( ) ;
163- provider . OnActivate ( "" , null ) ;
162+ provider . OnActivate ( string . Empty , null ) ;
164163 }
165164
166165 provider . guiHandler = ( searchContext ) =>
167166 {
168167 if ( globalSettingsEditor == null || globalSettingsEditor . serializedObject . targetObject == null )
169168 {
170169 EditorGUILayout . Space ( ) ;
171- EditorGUILayout . LabelField ( "Cannot find " + settingsType + " file located in this Project") ;
170+ EditorGUILayout . LabelField ( string . Format ( "Cannot find {0} file located in this Project" , settingsType ) ) ;
172171 EditorGUILayout . Space ( ) ;
173172
174173 if ( GUILayout . Button ( "Create a new settings file" ) )
@@ -182,9 +181,8 @@ void ReintializeProvider()
182181 return ;
183182 }
184183
185- var relativePath = locationPath
186- . Substring ( locationPath
187- . IndexOf ( "Assets/" ) ) + "/" + settingsType + ".asset" ;
184+ var assetName = string . Format ( "{0}.asset" , settingsType ) ;
185+ var relativePath = Path . Combine ( FileUtil . GetProjectRelativePath ( locationPath ) , assetName ) ;
188186
189187 AssetDatabase . CreateAsset ( settingsInstance , relativePath ) ;
190188 AssetDatabase . SaveAssets ( ) ;
0 commit comments