Hi, I have some options that will be applied to all objects with a certain component in the Scene.
For example, I have several text meshes in the scene and a font selector in GameManager. When that selector changes, all text meshes should change font in the scene view.
Right now I have a GameManagerEditor that will find all components in the scene and set the font (And the font material) but it doesn’t work. I have aswell a language selector and it should change the text of all text meshes, but it doesn’t work either.
Firstly, what am I doing wrong? Debugging I can see that the code does execute, and it iterates through the text. But something weird happens since, for example, the text of the meshes are empty while they should have text (If I go to the inspector I can see there is texts on them) which make me thik something is not ok.
Secondly, if there is a better way of doing this I would love to know.
Firstly, be aware that Resources.FindObjectsOfTypeAll will scan your prefab assets as well, and Object.FindObjectsOfType will return only active objects.
I’m working on a project with multi language support using events. I have a static settings class, something like
public static class Settings
{
static public event Action<UILanguage> EventChangeLanguage;
static UILanguage languageType = UILanguage.English;
static public UILanguage LanguageType
{
get
{
return languageType;
}
set
{
if (languageType == value)
return;
EventChangeLanguage(language);
}
}
}
and then a client behaviour attached to each Text UI Control (text, buttons, etc) listening this event