#In Unity Localization, how do you add a

1 messages · Page 1 of 1 (latest)

raw current
#

Did you manage to solve this? You would need to pass in a List into item 0 of Arguments for this example. You would probably pass a list of class instances which contain fields for typeName, frameValue and toValue.

weak sapphire
#

Thanks for the reply, sorry I didn't get any notification for it.

raw current
#

You pass the list as one of the argument values.

#

E.G loc.Arguments = new object[]{ list }

weak sapphire
#
struct ItemDescription
{
    public string typeName;
    public int fromValue;
    public int toValue;
}```
```cs
loc.Arguments = new List<ItemDescription>() {};
#

It will automagically take the fields with the same name as arguments?

weak sapphire
#

I decide to tackle this problem again, is there a sample on how to do options in Unity Localization?

#

Concatenation is extremely difficult to understand..

#

I need to localize attribute names in items for item options.

Like:

Agility: 5 -> 10
Strength: 15 -> 30
Defense: 10 -> 15```
#

These attributes are not fixed, and is random.
So I need a flexible method to fill in these item description..

#

Ideally I only want a single row entry for each option/attributes.

#

@raw current Is there any way I can pay to have a working sample of this?

#

I've been stuck for too long, I don't mind paying for this, as I can't seem to figure it out at all.

raw current
#

Hey. No need to pay.

#

Here is a simple example:

raw current
#
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Localization;

public class Example : MonoBehaviour
{
    public LocalizedString m_LocalizedString = new LocalizedString();

    public string itemName = "Sword";

    [Serializable]
    public struct ItemDescription
    {
        public string typeName;
        public int fromValue;
        public int toValue;
    }

    public List<ItemDescription> itemDescriptions;

    void Start()
    {
        m_LocalizedString.Arguments = new object[] { itemName, itemDescriptions };
        m_LocalizedString.StringChanged += OnStringChanged;
    }

    void OnStringChanged(string value)
    {
        Debug.Log(value);
    }
}
#

The smart string would be: {0}:\n{1:list:{typeName}: {fromValue} -> {toValue}|\n}

#

{0} - The name of the item

#

{1} - The list.