Hi, I was trying out your new localize package and ran into some issues I do not know how to solve.
- I have some problems with dynamic strings. What I want to achieve:
- Lets say I have several zodiacs on my screen.
- On the bottom of my screen I have a text field that shows the name of the current zodiac.
- A zodiac of course has also to be translated.
- Each Zodiac item has an specific id.
- What I already have is the id of the current selected zodiac and currently I write the id into the text field.
- Now I want to use that Id to automatically translate it to the correct name in my selected language and of course I want to have functionality that your localization brings in (auto update on switching languages etc)
- What I have tried so far is using a LocalizedString that has a standard table/entry name set in the inspector and I wanted to change the entry name dynamically using the zodiac id (string that matches the keys in my table) => did not work or I do not know how
- I added a TableEntryReference to each zodiac and once the selection changes it catches the current selected zodiac and its TableEntryReference, then I changed the TableEntryReference of my LocalizedString and tried a RefreshString() but it still had its old standard reference I have set in the inspector, so I have tried to call GetLocalizedString() which got the correct string and I was able to set the text field but after I switch the language and updateString got called it changed back to the old string reference.
How is the best way to solve that in C# ![]()
- I cannot open Asset Tables because I get following error:
ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <437ba245d8404784b9fbab9b439ac908>:0)
UnityEditor.Localization.UI.StringTableTreeViewItem.Initialize (System.Collections.Generic.List`1[T] tables, System.Int32 startIdx) (at Library/PackageCache/com.unity.localization@0.5.0-preview/Editor/UI/Tables/StringTableTreeViewItem.cs:19)
UnityEditor.Localization.UI.GenericAssetTableListView`2[T1,T2].CreateTreeViewItem (System.Int32 index, UnityEngine.Localization.Tables.KeyDatabase+KeyDatabaseEntry keyEntry) (at Library/PackageCache/com.unity.localization@0.5.0-preview/Editor/UI/Tables/GenericAssetTableListView.cs:171)
UnityEditor.Localization.UI.GenericAssetTableListView`2[T1,T2].BuildRoot () (at Library/PackageCache/com.unity.localization@0.5.0-preview/Editor/UI/Tables/GenericAssetTableListView.cs:201)
UnityEditor.IMGUI.Controls.TreeView+TreeViewControlDataSource.FetchData () (at <b43e6d4802d64ea8bbdaa0bf64614d3b>:0)
UnityEditor.IMGUI.Controls.TreeViewDataSource.ReloadData () (at <b43e6d4802d64ea8bbdaa0bf64614d3b>:0)
UnityEditor.IMGUI.Controls.TreeView+TreeViewControlDataSource.ReloadData () (at <b43e6d4802d64ea8bbdaa0bf64614d3b>:0)
UnityEditor.IMGUI.Controls.TreeViewController.ReloadData () (at <b43e6d4802d64ea8bbdaa0bf64614d3b>:0)
UnityEditor.IMGUI.Controls.TreeView.Reload () (at <b43e6d4802d64ea8bbdaa0bf64614d3b>:0)
UnityEditor.Localization.UI.GenericAssetTableListView`2[T1,T2].Initialize () (at Library/PackageCache/com.unity.localization@0.5.0-preview/Editor/UI/Tables/GenericAssetTableListView.cs:123)
UnityEditor.Localization.UI.StringTableEditor.OnIMGUI () (at Library/PackageCache/com.unity.localization@0.5.0-preview/Editor/UI/Tables/StringTableEditor.cs:33)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Boolean canAffectFocus) (at <b256487a5e4140809d026a943f161bc2>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
But if I use for example TextMesh => Localize I am able to add new entries to my created table and also able to select these created entries.
Hope this explains what I want to achieve.
Thanks in advance and best regards!
Luke
