Search Unity

Feature Request Remove entry in string table when removing GameObjectLocalizer component

Discussion in 'Localization Tools' started by Piotr_Wicher, Oct 26, 2021.

  1. Piotr_Wicher

    Piotr_Wicher

    Joined:
    Mar 31, 2020
    Posts:
    12
    Hi,

    Since GameObjectLocalizer have it's own editor, and AssetModificationProcessor "OnWillDeleteAsset" doesn't trigger when destryoing just component not whole prefab I can't find a way to delete entry in StringTable when GameObjectLocalizer is beeing destryoed. This can lead to many old entries in table durning development.

    Are you able to provide any solution to this problem?
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,277
    I'm not sure deleting the entry would be right as it's possible to share an entry across multiple areas so we don't want to remove something that is being used elsewhere.

    You can get a callback when a component is deleted by using ObjectChangeEvents.changesPublished which is available in 2020.2 and above however it wont actually tell you what was deleted, just the GameObject that was modified.

    Alternatively you could write a script to remove empty entries from a table.
    Using LocalizationEditorSettings you can get the collection and check each entry, if theres no values for any of the tables then delete the entry.