Skip to content

Commit 6747dcc

Browse files
committed
Update asset addresses after import completes, not during import
1 parent 040b0f4 commit 6747dcc

File tree

2 files changed

+30
-6
lines changed

2 files changed

+30
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1010

1111
### Changed
1212

13+
- `YarnProjectImporter` now updates asset addresses after the project import completes, rather than during the import.
14+
1315
### Removed
1416

1517
## [3.1.3] 2025-12-09

Editor/Importers/YarnProjectImporter.cs

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)