Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Feature Request Custom type for table

Discussion in 'Localization Tools' started by Wattosan, Oct 2, 2020.

  1. Wattosan

    Wattosan

    Joined:
    Mar 22, 2013
    Posts:
    460
    Hello,

    Currently the localization package supports a String table and an Asset table. It would be very helpful to have an Object table or a way to create tables with custom types.

    We would like to localize an array of materials (Material[]), which we'd then like to use on the mesh renderer. A mesh renderer can have multiple material entries and currently there is no good way to localize each of these materials. It is a requirement to have 1 material per mesh.

    If such a thing is already doable, please let us know!

    Thanks!
     
    Ruchir likes this.
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,412
    Hey,

    Interesting.
    I have 2 answers ;)

    1
    At the moment you can localize ScriptableObjects, these can contain any type of custom data you may want so you could put your list of materials in a SO for each language. and apply the changes with a script.
    E.G
    Code (csharp):
    1.  
    2. [CreateAsset]
    3. public class MyCustomData : ScriptableObject
    4. {
    5.    public Material[] materials;
    6. }
    7.  
    8. var materialsToApply = LocalizationSettings.AssetDatabase.GetLocalizedAssetAsync<MyCustomData>("My Values");
    9.  
    10. renderer.materials = materialsToApply;
    2
    We have an alternative workflow we are still developing that lets you localize any property through the inspector. Its not available yet but it would be perfect for what you need so keep an eye out for that. It's very exciting but also still a work in progress. We are hoping to have it available by the end of the year however it will likely require 2020.2+ :D
    It should allow you to solve your problem with zero additional scripts.

    I would use option 1 for now
     
    Ruchir and Wattosan like this.
  3. Wattosan

    Wattosan

    Joined:
    Mar 22, 2013
    Posts:
    460
    Thank you for the clarification!

    The scriptable object approach was also our second best method (the first one being able to do it as you described in your second answer or to make a custom extension).
     
    Ruchir and karl_jones like this.