Method AddPlatformEntryOverride
AddPlatformEntryOverride(RuntimePlatform, TableEntryReference)
Add a platform override for the current entry. This will use the same table collection but a different entry in the table than the one this Metadata is attached to. This is useful if you want to have overrides for entries that are stored in the same table.
Declaration
public void AddPlatformEntryOverride(RuntimePlatform platform, TableEntryReference entry)
Parameters
Type | Name | Description |
---|---|---|
RuntimePlatform | platform | The platform to override. |
TableEntryReference | entry | The entry to use instead of the current one. |
Examples
This example shows how you could set up platform overrides using a single table.
public void SetupEntryOverrideInEditor()
{
var collection = LocalizationEditorSettings.GetStringTableCollection("My Strings");
var englishTable = collection.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
englishTable.AddEntry("COPYRIGHT_NOTICE_PS4", "This is some copyright info for PS4 platforms...");
// Set up the platform override so that COPYRIGHT_NOTICE redirects to COPYRIGHT_NOTICE_PS4 when running on PS4.
var platformOverride = new PlatformOverride();
platformOverride.AddPlatformEntryOverride(RuntimePlatform.PS4, "COPYRIGHT_NOTICE_PS4");
entry.SharedEntry.Metadata.AddMetadata(platformOverride);
// Mark the assets dirty so changes are saved
EditorUtility.SetDirty(collection.SharedData);
EditorUtility.SetDirty(englishTable);
}