@@ -120,23 +120,6 @@ proc importFile(string $filePathStr){
120
120
121
121
if ((!$isAnimFile || ($isAnimFile && $setCreated)) && $tempPath != ""){
122
122
storeAttribute($unityExportSet, $UnityFbxFilePathAttr, $tempPath);
123
-
124
- // Change Unity project if fbx is from a different Unity project.
125
- // Get the project based on the folder structure (i.e. folder above Assets)
126
- $head = dirname($tempPath);
127
- $tail = basename($tempPath, "");
128
- // Check that we are not at the root directory.
129
- // dirname($head) returns the last directory name in the path,
130
- // or head if head is the root directory.
131
- while ($head != "" && dirname($head) != $head){
132
- if (`strcmp $tail "Assets"` == 0){
133
- // this is a valid Unity project, so set it
134
- optionVar -sv "UnityProject" $head;
135
- break;
136
- }
137
- $head = dirname($head);
138
- $tail = basename($head, "");
139
- }
140
123
}
141
124
142
125
if ((!$isAnimFile || ($isAnimFile && $setCreated)) && $tempName != ""){
@@ -214,6 +197,24 @@ global proc unityImport(){
214
197
$filePathStr = $filePaths[$i];
215
198
importFile($filePathStr);
216
199
}
200
+
201
+ $tempPath = dirname($filePaths[0]);
202
+ // Change Unity project if fbx is from a different Unity project.
203
+ // Get the project based on the folder structure (i.e. folder above Assets)
204
+ $head = dirname($tempPath);
205
+ $tail = basename($tempPath, "");
206
+ // Check that we are not at the root directory.
207
+ // dirname($head) returns the last directory name in the path,
208
+ // or head if head is the root directory.
209
+ while ($head != "" && dirname($head) != $head){
210
+ if (`strcmp $tail "Assets"` == 0){
211
+ // this is a valid Unity project, so set it
212
+ optionVar -sv "UnityProject" $head;
213
+ break;
214
+ }
215
+ $head = dirname($head);
216
+ $tail = basename($head, "");
217
+ }
217
218
}
218
219
219
220
0 commit comments