Changing font asset and material at the same time for a language

More
4 years 9 months ago #3835 by topspin
How to do this?
I can do this currently by adding 2 Localize component to the TextMeshProUGUI object. The first one contains the main term and a secondary term which changes font asset. The second Localize component has main term set to <none> and a secondary term which changes the material. Is this the intended way of doing this?

Please Log in or Create an account to join the conversation.

More
4 years 9 months ago #3855 by Frank
Yes,
You can change the font, the material or both.

It can be done by one of two ways:

1- Add a secondary term and set it to TMP Font or Material type. Then set your font assets or materials per language.
inter-illusion.com/assets/I2Localization...FontperLanguage.html
Notice that when using this approach, if you set a font, I2 Localization will select the first material that matches that font as well.
And if you are setting a material, then, the plugin will find the font corresponding to that material and apply both.

or

2- In your translation text, set the name of the Font/Material as a tag at the beginning of the text
(e.g. instead of "This is an example", add "[MaterialName]This is an example"
That allows you to define a font to set (using the Secondary Term) and the specific material you wan to use.

Hope that helps,
Frank

Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out

Please Log in or Create an account to join the conversation.

More
4 years 9 months ago #3860 by topspin
Can you confirm that with the first approach, I need to have 2 Localize components on the Text object? Why not make the second term a List? Or even just use one List<Terms>?

Right now Main term is hardcoded to set the Text of Text component. Why is that necessary since you already have Text Terms which should serve as a hint to set Text?

It would be great if the Localize component just has a list of Terms and what each Term does is up to their Type.

Please Log in or Create an account to join the conversation.

More
4 years 9 months ago #3861 by Frank

Can you confirm that with the first approach, I need to have 2 Localize components on the Text object?


Now, you don't need two localize components.

Lets say that you have two fonts ("Arial SDF" and "Roboto SDF")
Then, you have two materials for each of them:
"Arial SDF - Shadow" and "Arial SDF - Outlined"
"Roboto SDF - Shadow" and "Roboto SDF - Outlined"


If you want to change a label to use "Roboto SDF" with the "Roboto SDF -Outlined" material,
then:

Add 1 Localize component
- Set the main term to be whatever you want the label text to show
- Set the secondary term to a term of type Material referencing the "Roboto SDF - Outlined"

When the localization happens, the plugin will take the material, find the font matching that material and change the label font and material to those.

Now, if you just want to change the font and select the default material for that font,
Then, set the Secondary term to a term of type "TMP Font" pointing to "Arial SDF". The plugin will ask TMPro for the default material for that font and apply it.

Either way, its just 1 localize component if you want to change the font, material or both.

It would be great if the Localize component just has a list of Terms and what each Term does is up to their Type.


I agree.
I have in my todo list a detailed task to redo the way how the terms work to avoid to force two term in a localize component, and greatly simplify it.
But given that all cases can be solved by using the current system, there seems to always be something with a higher priority that pushes that task to the backlog.

Hopefuly now that E3 is over, I should have more time to complete more of the high priority taks and clear the list!!

Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out

Please Log in or Create an account to join the conversation.

More
4 years 9 months ago #3862 by topspin
Awesome thanks. I overlooked the fact that Material presets implies a font asset already.

Please Log in or Create an account to join the conversation.

More
3 years 4 months ago #4180 by joon
It seems like the Material auto-assign doesn't work with dynamic atlases, or with the newest version of TmPro.
If I use Fontasset names, it works well, but if I use Material names, it doesn't affect the font.
Or it will sometimes even pick the wrong one.

Can you help me track down where in the code this assignment happens, then I can probably fix or debug it myself and provide more info.

I'm on Unity 2019.4.9f1, Tmpro 2.1.3, I2L 2.8.12 f1.

Please Log in or Create an account to join the conversation.

Time to create page: 0.397 seconds
Template by JoomlaShine