Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Bug Removed entries in CSV stay in StringTableCollection after import

Discussion in 'Localization Tools' started by TheRealGrendel, Apr 11, 2022.

  1. TheRealGrendel

    TheRealGrendel

    Joined:
    Jun 17, 2016
    Posts:
    16
    Hello! I tried searching the forum to see if others had this issue but couldn't find anything, so apologies if this is a repeat question. I recently split an StringTableCollection into two for better organization but I'm having issues removing entries from my source table. Here's what I'm doing:
    1. I had a StringTableCollection with a bunch of entries I wanted in another table
    2. I wrote a small program to copy everything to a new table and carry the references, which went well
      • Now I had two tables, my source table containing all the data, and my secondary table containing only the data I wanted
    3. I exported the CSV of my source table and removed all the shared keys, so that the source table CSV now only has entries the didn't get carried over to the new table
    4. When I reimport the CSV to the source table, the old keys still remain, even though they no longer exist in the CSV
    My first thought is that the 'Import' button doesn't completely clear and rebuild the table on import, just update existing entries and add new ones. If this is the case, adding an option to rebuild from scratch would be fantastic. Otherwise, I believe this is a bug.
    I can currently get around this by remaking the StringTableCollection entirely, but I'd rather not go through this process in the future if possible. If there is another solution, please let me know!
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,846
    Hi,

    You are correct the import will not clear the entries before importing, this is by design as we want to preserve data such as ids, metadata etc.
    How are you importing the CSV, are you using a script or the menu items? In 1.2.1 we added an option to Import Into called removeMissingEntries which should do what you need. The menu now has 2 options Import/CSV which will use the remove missing keys and Import/CSV(Merge) which preserves the keys.
    It may just be that you need to upgrade to 1.2.1 if you are not already on it.
     
  3. TheRealGrendel

    TheRealGrendel

    Joined:
    Jun 17, 2016
    Posts:
    16
    Ah yep, that's exactly what I'm looking for. I'm still working on 1.1.1 so an upgrade will be all I need. Thanks Karl!
     
    karl_jones likes this.
  4. awallick-sd

    awallick-sd

    Joined:
    May 29, 2019
    Posts:
    13
    Hi @karl_jones ! We are trying to use the CSV extension to accomplish this because we are importing a CSV with different column headers than the default.

    From what I can tell there's no way to accomplish that as part of the extension (just one import option). I only see the two options in the table editor itself, and that doesn't seem to use the custom values from the extension.

    Would there be a way to add that option to the extension as well (or is there something I'm missing)?

    Thank you!
     
  5. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,846
    You want to map against custom column headers? You can do this. Either add a CSV extension to the string table collection and then configure the columns through it or use the script API which lets you pass in a list of columns which can be configured.
     
  6. awallick-sd

    awallick-sd

    Joined:
    May 29, 2019
    Posts:
    13
    We’re using the CSV extension for the custom headers currently and it’s working great! Really awesome feature, thanks!!

    The issue is the open/import button on the extension seem to function in “merge” mode, and we’d love to have the non-merge mode to remove missing keys. I don’t see a way to do that right now via the UI with the custom headers. I could probably do this in code but figured I’d register my interest.
     
    dreed-sd likes this.