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. Dismiss Notice

Question How to undo override on AssetTableEntry?

Discussion in 'Localization Tools' started by choijaeyoung, Apr 26, 2023.

  1. choijaeyoung

    choijaeyoung

    Joined:
    Feb 8, 2020
    Posts:
    11
    So, I have a code set up for player to switch between one style of font (for artistic purpose) and other style of font (for legibility purpose).

    I managed to find relevant method which is:

    Code (CSharp):
    1. var entry = value.GetEntry("Text font");
    2. var non = LocalizationSettings.AssetDatabase.GetLocalizedAssetAsync<TMP_FontAsset>(textNonpixel);
    3. yield return non;
    4. TMP_FontAsset nonPixeltext = non.Result;
    5. entry.SetAssetOverride(nonPixeltext);
    It will override the default artistic font into more legible font. However, how do I "undo" the override? After you've overridden your default artistic font, any time after you call
    Code (CSharp):
    1. var non = LocalizationSettings.AssetDatabase.GetLocalizedAssetAsync<TMP_FontAsset>(regular);
    2.  
    you get the legibility font instead because it is overridden already. However, I found out that changing selected languages several times with some delay actually resets this override on Asset Table Entry. How can I achieve that?
     
  2. karl_jones

    karl_jones

    Unity Technologies

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

    To remove the override you need to release the asset, this is done through the AssetTable.
    E.G

    Code (csharp):
    1. var table = LocalizationSettings.AssetDatabase.GetTable(LocalizationSettings.AssetDatabase.DefaultTable);
    2. table.ReleaseAsset(textNonpixel);
     
  3. choijaeyoung

    choijaeyoung

    Joined:
    Feb 8, 2020
    Posts:
    11
    Thank you, it worked great!