It looks like you want to change a LocalizedStrings StringReference using a UnityEvent. We dont have a way to do this out of the box although it should be simple to support so ill add a task for us to add support in the future.
For now you can create a simple script to do it:
using UnityEngine;
using UnityEngine.Localization.Components;
public class ChangeString : MonoBehaviour
{
public LocalizeStringEvent localizedStringEvent;
public void ChangeStringEntry(string keyName)
{
localizedStringEvent.StringReference.TableEntryReference = keyName;
}
}
I seem to have all the pieces in the right place, yet it’s not working.
Also note : They are Two event triggers - Pointer Down and Pointer Up. So in theory I would need two Localize String Event component on the same item right?
My present result : unity tooltips display BlackBreadDown and BlackBreadUp, instead of the aaa, bbb, CCC, DDD that are in the localization table.
No you should only need 1 localize string component. You have 2 different values in the set table entry callback.
In the onpointer events you call the change string script and set the table entry
Not sure why it’s not working.
Are their any plans to support tooltips - out of the box? - I’m guessing it’s a must in any localization package since tooltips are is many games.
I see now! thanks to both of you! Your combined contribution pointed me to the proper setup.
Yet, they still remain an issue. It’s not giving the same behavior as the tooltip.
Here are three image.
1.The inventory is empty and have it’s own Localization text.
2. The item is revealed. issue 1 : It now displays the Pointer Down text.
3. when you Pointer Down on the item, it displays the Pointer UP text.
Now, after this sequence, the behavior is then resolved. Meaning, after step 3, if I press again, I will get the proper Pointer Down and Pointer Up text.
Preparing a scene I found out what I was doing wrong. The string reference was set to my Pointer Down text.
If I set my String Reference to my Pointer Up text, I get the behavior which I was looking for.