@@ -46,7 +46,7 @@ public override void OnInspectorGUI() {
46
46
"Relative path for saving Model Prefabs." ) ) ;
47
47
48
48
var pathLabel = ExportSettings . GetRelativeSavePath ( ) ;
49
- if ( pathLabel == "./ " ) { pathLabel = "(Assets root)" ; }
49
+ if ( pathLabel == "." ) { pathLabel = "(Assets root)" ; }
50
50
EditorGUILayout . SelectableLabel ( pathLabel ,
51
51
EditorStyles . textField ,
52
52
GUILayout . MinWidth ( SelectableLabelMinWidth ) ,
@@ -128,7 +128,13 @@ public class ExportSettings : ScriptableSingleton<ExportSettings>
128
128
129
129
/// <summary>
130
130
/// The path where Convert To Model will save the new fbx and prefab.
131
- /// This is relative to the Application.dataPath
131
+ ///
132
+ /// To help teams work together, this is stored to be relative to the
133
+ /// Application.dataPath, and the path separator is the forward-slash
134
+ /// (e.g. unix and http, not windows).
135
+ ///
136
+ /// Use GetRelativeSavePath / SetRelativeSavePath to get/set this
137
+ /// value, properly interpreted for the current platform.
132
138
/// </summary>
133
139
[ SerializeField ]
134
140
string convertToModelSavePath = kDefaultSavePath ;
@@ -142,6 +148,18 @@ public static string GetRelativeSavePath() {
142
148
if ( string . IsNullOrEmpty ( relativePath ) ) {
143
149
relativePath = kDefaultSavePath ;
144
150
}
151
+
152
+ // Normalize to the platform path separator.
153
+ relativePath = relativePath . Replace ( Path . AltDirectorySeparatorChar ,
154
+ Path . DirectorySeparatorChar ) ;
155
+
156
+ // Trim off trailing slashes. If all we had was slashes, we're at
157
+ // the root of the Application.dataPath so return "."
158
+ relativePath = relativePath . TrimEnd ( Path . DirectorySeparatorChar ) ;
159
+ if ( string . IsNullOrEmpty ( relativePath ) ) {
160
+ relativePath = "." ;
161
+ }
162
+
145
163
return relativePath ;
146
164
}
147
165
@@ -160,7 +178,9 @@ public static string GetAbsoluteSavePath() {
160
178
/// This is interpreted as being relative to the Application.dataPath
161
179
/// </summary>
162
180
public static void SetRelativeSavePath ( string newPath ) {
163
- instance . convertToModelSavePath = newPath ;
181
+ instance . convertToModelSavePath = newPath
182
+ . Replace ( '\\ ' , '/' )
183
+ . TrimEnd ( Path . DirectorySeparatorChar ) ;
164
184
}
165
185
166
186
[ MenuItem ( "Edit/Project Settings/Fbx Export" , priority = 300 ) ]
@@ -204,8 +224,7 @@ private static T CreateAndLoad()
204
224
// First create.
205
225
if ( s_Instance == null )
206
226
{
207
- T t = ScriptableObject . CreateInstance < T > ( ) ;
208
- s_Instance = t ;
227
+ s_Instance = ScriptableObject . CreateInstance < T > ( ) ;
209
228
}
210
229
211
230
// Then load.
0 commit comments