Get localized material

7 months 1 week ago #4021 by Cvita
Get localized material was created by Cvita
How to get localized material via script?

I have a ParticleSystemRenderer component, which' material I want to change.

I have the Material term, just not sure how to retrieve it via script.

Any ideas?

Kind regards,

P.S. Side question; I notice sometime when the term is not text (is a font, or a material) and I open the term in the Inspector, the values are grey and blank (bellow the placeholder for object link it says the textual name of this font, but the field itself is empty). I then assign the font to the slot and all corresponding slots get filled as well.
Not even sure if I am describing this correctly. Would love to understand why the textual name of the font is there (bellow the field) but the field itself is empty. Actually, I would just like to know does this mean that the link to the font itself is broken and I need to re-link it? Or I don't need to do anything.
Sometimes I worry that these links/references are being parsed in some way that is not native to unity and my whole project will collapse if I press a wrong button. Welcome to my nightmare :)

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

7 months 1 week ago #4022 by Cvita
Replied by Cvita on topic Get localized material
I figured it out!
public Localization localizedMaterial;
public ParticleSystemRenderer particleSystemRenderer;

string matName = LocalizationManager.GetTermTranslation("material_term_name");
Material getTermMaterial = localizedMaterial.FindTranslatedObject<Material>(matName);
particleSystemRenderer.material = getTermMaterial;

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

Time to create page: 0.105 seconds
Template by JoomlaShine