"Localized String Event" works only with script reference within same game object

Hey,
I am playing around with the Localization Package and I am stuck at the following point.

My test class looks like that:

public class LocalizedVariables : MonoBehaviour
{
    public string playername = "testname";
}

The localization works, if I attach this script as a component to my Text game object and drag the script into the “format arguments - element 0” field like shown below:

180037-1.jpg

However, with a small change the localization does not work anymore. If I drag the script from the project area into this field the text field does not get any value anymore.

In this example you could say that it does not make a difference and that the first way just works fine, but what I actually want to do is to drag a reference e. g. of my PlayerMovement script into this “Format Arguments” field to use the script where the playername is actually used.

Choosing the first way would mean that every single Text object needs an extra script which holds the respective value as a copy.


Am I doing anything wrong or does the localization package simply not support this right now?

It looks like you dragged a reference to the Game object and not the component. Try opening 2 inspectors and dragging the component over from 1 to the reference field.

Have a look at my second screenshot above. I did not drag the Game object but the script from the project menu.


Nevertheless, I gave it a try with 2 inspector tabs, one locked at the text object and the other showing the object holding the target script. Dragging from the one inspector to the other works indeed too, however this is a quit complicated way and probably not the intended one, right?