Created
February 5, 2024 10:54
-
-
Save karljj1/d448e71ba8f396555a04d5b07260da00 to your computer and use it in GitHub Desktop.
Example of removing a locale and its assets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void RemoveLocale(LocaleIdentifier localeIdentifier) | |
{ | |
foreach (var collectionStrings in LocalizationEditorSettings.GetStringTableCollections()) | |
{ | |
var table = collectionStrings.GetTable(localeIdentifier); | |
if (table != null) | |
{ | |
collectionStrings.RemoveTable(table); | |
AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(table)); | |
} | |
} | |
foreach (var collectionAssets in LocalizationEditorSettings.GetAssetTableCollections()) | |
{ | |
var table = collectionAssets.GetTable(localeIdentifier); | |
if (table != null) | |
{ | |
collectionAssets.RemoveTable(table); | |
AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(table)); | |
} | |
} | |
var locale = LocalizationEditorSettings.GetLocale(localeIdentifier); | |
if (locale != null) | |
{ | |
LocalizationEditorSettings.RemoveLocale(locale); | |
AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(locale)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment