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

Question "Type Mismatch" while assigning Fallback Locale

Discussion in 'Localization Tools' started by gnsozkan, Sep 8, 2022.

  1. gnsozkan

    gnsozkan

    Joined:
    Dec 30, 2020
    Posts:
    2
    Hello,

    I'm trying to assign a fallback locale to a locale in script using
    Code (CSharp):
    1. locale.Metadata.AddMetadata(new FallbackLocale(Locale.CreateLocale(fallbackLocale)));
    In editor, fallback locale is assigned to the locale but it says "Type Mismatch".

    Is there something wrong I am doing?
     

    Attached Files:

  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,876
    The Locale needs to be persistent. Doing
    Locale.CreateLocale(fallbackLocale)
    will create a Locale in memory that will be destroyed at some point. Likely causing the type mismatch.
    You should assign a Locale asset. Create one in the project and then get to it with
    LocalizationEditorSettings.GetLocale
    .
     
    ibrahimpenekli likes this.
  3. gnsozkan

    gnsozkan

    Joined:
    Dec 30, 2020
    Posts:
    2
    Thank you Karl, that solved my problem.
     
    karl_jones likes this.