diff --git a/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationImporter.cs b/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationImporter.cs index 9d8a212da..5432f7c85 100644 --- a/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationImporter.cs +++ b/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationImporter.cs @@ -13,9 +13,19 @@ public static class LocalizationImporter public static async void ImportAllFromSheet(string webAppUrl) { string json = await GoogleSheetWebClient.Get(webAppUrl); - if (string.IsNullOrEmpty(json)) return; + if (string.IsNullOrEmpty(json)) + { + Debug.LogError("[Localization Import] Google Sheet로부터 데이터를 가져오지 못했습니다."); + return; + } var payload = JsonConvert.DeserializeObject(json); + if (payload == null || payload.Tables == null || payload.Tables.Count == 0) + { + Debug.LogWarning("[Localization Import] 불러온 데이터가 비어있습니다."); + return; + } + foreach (var kv in payload.Tables) { string tableName = kv.Key; @@ -29,27 +39,34 @@ public static async void ImportAllFromSheet(string webAppUrl) } var shared = collection.SharedData; + EditorUtility.SetDirty(shared); // ✅ SharedData 저장 대상 표시 foreach (var row in rows) { - if (!row.TryGetValue("Key", out var key)) continue; + if (!row.TryGetValue("Key", out var key) || string.IsNullOrEmpty(key)) continue; + var sharedEntry = shared.GetEntry(key) ?? shared.AddKey(key); foreach (var localeCode in row.Keys) { if (localeCode == "Key") continue; + var table = collection.GetTable(localeCode) as StringTable; - if (table == null) continue; + if (table == null) + { + Debug.LogWarning($"[Localization] Table '{tableName}'의 로케일 '{localeCode}' 테이블이 존재하지 않습니다."); + continue; + } table.AddEntry(sharedEntry.Id, row[localeCode]); - EditorUtility.SetDirty(table); + EditorUtility.SetDirty(table); // ✅ StringTable 저장 대상 표시 } } - - AssetDatabase.SaveAssets(); } - Debug.Log("[Localization Import] 완료"); + AssetDatabase.SaveAssets(); // ✅ 변경사항 저장 + + Debug.Log("[Localization Import] 완료: Google Sheet → Unity"); } } } diff --git a/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationManager.cs b/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationManager.cs index eccd25c8d..4ada9b995 100644 --- a/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationManager.cs +++ b/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationManager.cs @@ -8,6 +8,7 @@ public enum TableName None = 0, Item_Name, Item_Description, + Global_Message, } public static class LocalizationManager