@@ -1112,15 +1112,37 @@ private void CreateYarnInternalLocalizationAssets(AssetImportContext ctx, YarnPr
11121112 foreach ( var ( id , asset ) in assetPaths )
11131113 {
11141114 newLocalization . AddLocalizedObjectToAsset ( id , asset ) ;
1115+ }
1116+
11151117#if USE_ADDRESSABLES
1116- if ( newLocalization . UsesAddressableAssets )
1118+ // If we're using addressable assets, make sure that the
1119+ // assets we just added have an address. Do this after the
1120+ // import completes, because we're not allowed to modify the
1121+ // addressable asset settings in the middle of an import.
1122+ if ( newLocalization . UsesAddressableAssets )
1123+ {
1124+ EditorApplication . delayCall += ( ) =>
11171125 {
1118- // If we're using addressable assets, make sure that
1119- // the asset we just added has an address
1120- LocalizationEditor . EnsureAssetIsAddressable ( asset , Localization . GetAddressForLine ( id , localisationInfo . languageID ) ) ;
1121- }
1122- #endif
1126+ var assetCount = assetPaths . Count ( ) ;
1127+ int count = 0 ;
1128+
1129+ foreach ( var ( id , asset ) in assetPaths )
1130+ {
1131+ // Updating asset addresses can take time, so
1132+ // show a progress bar that the user can cancel.
1133+ var cancelled = EditorUtility . DisplayCancelableProgressBar ( "Updating Dialogue Asset Addresses" , asset . name , count / ( float ) assetCount ) ;
1134+ if ( cancelled )
1135+ {
1136+ Debug . LogWarning ( "Cancelled updating dialogue asset paths." ) ;
1137+ break ;
1138+ }
1139+ LocalizationEditor . EnsureAssetIsAddressable ( asset , Localization . GetAddressForLine ( id , localisationInfo . languageID ) ) ;
1140+ count += 1 ;
1141+ }
1142+ EditorUtility . ClearProgressBar ( ) ;
1143+ } ;
11231144 }
1145+ #endif
11241146
11251147#if YARNSPINNER_DEBUG
11261148 stopwatch . Stop ( ) ;
0 commit comments