@@ -180,27 +180,40 @@ public override void OnInspectorGUI() {
180
180
}
181
181
EditorGUI . EndDisabledGroup ( ) ;
182
182
183
- if ( ! HideRepairMissingScripts ( ) ) {
184
- EditorGUILayout . Space ( ) ;
185
-
186
- EditorGUI . indentLevel -- ;
187
- EditorGUILayout . LabelField ( "Repair Missing Scripts" , EditorStyles . boldLabel ) ;
188
- EditorGUI . indentLevel ++ ;
183
+ EditorGUILayout . Space ( ) ;
189
184
190
- EditorGUILayout . Space ( ) ;
185
+ EditorGUI . indentLevel -- ;
186
+ EditorGUILayout . LabelField ( "Run Component Updater" , EditorStyles . boldLabel ) ;
187
+ EditorGUI . indentLevel ++ ;
191
188
192
- var repairMissingScripts = new GUIContent (
193
- "Repair Missing Scripts" ,
194
- "Repair missing FbxPrefab scripts in text assets" ) ;
195
- if ( GUILayout . Button ( repairMissingScripts ) ) {
196
- bool result = FbxExporters . Editor . RepairMissingScripts . ReplaceGUIDInTextAssets ( ) ;
189
+ EditorGUILayout . Space ( ) ;
190
+
191
+ var repairMissingScripts = new GUIContent (
192
+ "Run Component Updater" ,
193
+ "If the forum package 1.1.0b1 was previously installed, then links to the FbxPrefab component " +
194
+ "in assets created with the FBX exporter will need updating.\n " +
195
+ "Run this button to update all FbxPrefab references in text serialized prefabs and scene files." ) ;
196
+
197
+ if ( GUILayout . Button ( repairMissingScripts ) ) {
198
+ var componentUpdater = new FbxExporters . Editor . RepairMissingScripts ( ) ;
199
+ var filesToRepairCount = componentUpdater . GetAssetsToRepairCount ( ) ;
200
+ var dialogTitle = "FBX Exporter Component Updater" ;
201
+ if ( filesToRepairCount > 0 ) {
202
+ bool result = UnityEditor . EditorUtility . DisplayDialog ( dialogTitle ,
203
+ string . Format ( "Found {0} prefab and/or scene file(s) with components requiring update.\n \n " +
204
+ "If you choose 'Go Ahead', the FbxPrefab components in these assets " +
205
+ "will be automatically updated to work with the latest FBX exporter.\n " +
206
+ "You should make a backup before proceeding." , filesToRepairCount ) ,
207
+ "I Made a Backup. Go Ahead!" , "No Thanks" ) ;
197
208
if ( result ) {
198
- UnityEditor . EditorUtility . DisplayDialog ( "Finished Repairing Scripts" ,
199
- "Repaired missing scripts in text serialized assets" , "Ok" ) ;
209
+ componentUpdater . ReplaceGUIDInTextAssets ( ) ;
200
210
} else {
201
- UnityEditor . EditorUtility . DisplayDialog ( "Finished Repairing Scripts" ,
202
- "Couldn't find any assets needing repair ", "Ok" ) ;
211
+ var assetsToRepair = componentUpdater . GetAssetsToRepair ( ) ;
212
+ Debug . LogFormat ( "Failed to update the FbxPrefab components in the following files: \n {0} ", string . Join ( " \n " , assetsToRepair ) ) ;
203
213
}
214
+ } else {
215
+ UnityEditor . EditorUtility . DisplayDialog ( dialogTitle ,
216
+ "Couldn't find any text assets that require updating" , "Ok" ) ;
204
217
}
205
218
}
206
219
@@ -214,11 +227,6 @@ public override void OnInspectorGUI() {
214
227
}
215
228
}
216
229
217
- private static bool HideRepairMissingScripts ( ) {
218
- var docPath = Application . dataPath + "/FbxExporters/FBX_Exporter_User_Guide_v1.1.0b1.pdf" ;
219
- return File . Exists ( docPath ) ? false : true ;
220
- }
221
-
222
230
private static string TryFindDCC ( string dccPath , string ext , ExportSettings . DCCType dccType ) {
223
231
string dccName = "" ;
224
232
switch ( dccType ) {
0 commit comments