Method AddPlatformTableOverride
AddPlatformTableOverride(RuntimePlatform, TableReference)
Add a platform override for the current table collection. This will result in the table being switched but the same entry name being used. This is useful if you want to have specialist tables that will implement the same keys for certain entries.
Declaration
public void AddPlatformTableOverride(RuntimePlatform platform, TableReference table)
Parameters
Type | Name | Description |
---|---|---|
RuntimePlatform | platform | The platform to override. |
TableReference | table | The table collection to use instead of the current one. |
Examples
This example shows how you could set up platform overrides using a table for each platform.
public void SetupTableOverrideInEditor()
{
// Get the 2 table collections. 1 for default and 1 for our chosen platform (PS4).
var collection = LocalizationEditorSettings.GetStringTableCollection("My Strings");
var collectionPs4 = LocalizationEditorSettings.GetStringTableCollection("My Strings PS4");
var englishTable = collection.GetTable("en") as StringTable;
var englishTablePs4 = collectionPs4.GetTable("en") as StringTable;
// Add the default entry
var entry = englishTable.AddEntry("COPYRIGHT_NOTICE", "This is some copyright info for general platforms...");
// Add the entry we want to use on PS4 using the same entry name.
englishTablePs4.AddEntry("COPYRIGHT_NOTICE", "This is some copyright info for PS4 platforms...");
// Set up the platform override so that COPYRIGHT_NOTICE redirects to a different table but uses the same key.
var platformOverride = new PlatformOverride();
platformOverride.AddPlatformTableOverride(RuntimePlatform.PS4, "My Strings PS4");
entry.SharedEntry.Metadata.AddMetadata(platformOverride);
// Mark the assets dirty so changes are saved
EditorUtility.SetDirty(collection.SharedData);
EditorUtility.SetDirty(englishTable);
}