How can I load the list of term at custom editor.
10 years 1 month ago #531
by 80dots
How can I load the list of term at custom editor. was created by 80dots
Hello.
I'm using I2 Localize.
It works very well.~!
But I have a problem.
My game needs various item types. Thus, I'm implementing the tool for managing the items.
I'm using UnityEditor package. And I want to display the list of terms using 'EditorGUILayout.Popup()' method.
Draftly... Refer to the source code below.
======================================================================
//Make the Array for list of terms.
string[] termList = new string[LocalizationManager.GetTermsList().Count];
//Input term data to array.
for (int a = 0; a < LocalizationManager.GetTermsList().Count; a++ )
{
termList[a] = LocalizationManager.GetTermsList()[a];
}
this.itemName= EditorGUILayout.Popup("Item name", this.itemName, termList, EditorStyles.popup);
======================================================================
The problem is that I can't refer to LocalizeManager class if it's not runtime.
During runtime, it's works very well.
How can I solve it?
Thanks.
I'm using I2 Localize.
It works very well.~!
But I have a problem.
My game needs various item types. Thus, I'm implementing the tool for managing the items.
I'm using UnityEditor package. And I want to display the list of terms using 'EditorGUILayout.Popup()' method.
Draftly... Refer to the source code below.
======================================================================
//Make the Array for list of terms.
string[] termList = new string[LocalizationManager.GetTermsList().Count];
//Input term data to array.
for (int a = 0; a < LocalizationManager.GetTermsList().Count; a++ )
{
termList[a] = LocalizationManager.GetTermsList()[a];
}
this.itemName= EditorGUILayout.Popup("Item name", this.itemName, termList, EditorStyles.popup);
======================================================================
The problem is that I can't refer to LocalizeManager class if it's not runtime.
During runtime, it's works very well.
How can I solve it?
Thanks.
Please Log in or Create an account to join the conversation.
10 years 1 month ago #532
by Frank
Are you
Give I2L
5 stars!
Are you
Please lets us know how to improve it!
Replied by Frank on topic How can I load the list of term at custom editor.
Hi
In the current version you need to call LocalizationManager.UpdateSources() and then Source.UpdateDictionary() at least once before accessing the terms.
This was corrected on version 2.4.4 b2 and will be available for download from the community release page on monday.
Nonetheless, for now you can do it as in the next example:
Thanks,
Frank
In the current version you need to call LocalizationManager.UpdateSources() and then Source.UpdateDictionary() at least once before accessing the terms.
This was corrected on version 2.4.4 b2 and will be available for download from the community release page on monday.
Nonetheless, for now you can do it as in the next example:
public class TestWindow : EditorWindow
{
int Index = 0;
[MenuItem("Help/Test")]
public static void DoShowScreen()
{
// This is no longer needed on version 2.4.4 b2
I2.Loc.LocalizationManager.UpdateSources();
foreach( I2.Loc.LanguageSource source in I2.Loc.LocalizationManager.Sources )
source.UpdateDictionary();
/////////////////////
EditorWindow.GetWindowWithRect<TestWindow>(new Rect(0f, 0f, 670f, 510f), true, "Test");
}
public void OnGUI()
{
string[] termList = I2.Loc.LocalizationManager.GetTermsList().ToArray();
Index = EditorGUILayout.Popup("Item name", Index, termList, EditorStyles.popup);
}
}
Thanks,
Frank
Are you

Are you

To get the betas as soon as they are ready,
check this out
Please Log in or Create an account to join the conversation.
Time to create page: 0.198 seconds