How can I load the list of term at custom editor.

5 years 6 months ago #531 by 80dots

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?


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

5 years 6 months ago #532 by 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;

	public static void DoShowScreen()
		// This is no longer needed on version 2.4.4 b2
		foreach( I2.Loc.LanguageSource source in I2.Loc.LocalizationManager.Sources )

		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);


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.

Time to create page: 0.151 seconds
Template by JoomlaShine