Hello,
I want to add language change option in-game. But I am new in coding and localization. can someone please help me on code?
Thanks.
There is a sample in the package called LocaleMenuIMGUI that should give you something to start with.
Open the package manager and look at the samples section for the package.
Thanks for quick help. As I never use script for implementing UIs. itâs really tough to understand UI part of those scripts.
I want UI to look like my game UI style (I added some text using Photoshop for better understanding):
Here is an example scene with 2 different ways to create a language selection menu.
These samples will also be in the next release
Thank you so much for this great help :). But when I imported this package, console gives me 182 errors. Most are for words with ââ. Like [test] [SetUp] etc.
Example:
The type or namespace name âSetUpâ could not be found (are you missing a using directive or an assembly reference?)
So, I deleted them (Are they needed?) But after deleting all these words there is still 16 errors of these:
The type or namespace name âPoolâ does not exist in the namespace âUnityEngineâ (are you missing an assembly reference?)
The type or namespace name âNUnitâ could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name âIPrebuildSetupâ could not be found (are you missing a using directive or an assembly reference?)
Ah for some reason it exported way too much. You have a bunch of the Localization tests
ok here is a cut down version with just what you need
Ok, Thanks. Localization change is working fine in editor but in Android device it is Not clickable in dropdown mode (And maybe same with the other one). I tried previously with the sample package LocaleMenuIMGUI available in package manager and that time also same thing. Nothing was visible that time too. is IMGUI support in Android devices?
Other than that can we add Language option like this (Available in LocaleMenuIMGUI):
Russian (Russian in russian language)
Arabic (Arabic in arabic language)
If this is something easy to implement then please add this feature otherwise never mind.
It should work in Android. Are you using the new input system?
No, I am not using new input system.
while debugging my game, I found these errors, maybe helpfull:
08-08 16:38:54.923: E/Unity(21408): MissingMethodException: Default constructor not found for type UnityEngine.ResourceManagement.ResourceManager+CompletedOperation`1[[System.Collections.Generic.IList`1[[UnityEngine.Localization.Locale, Unity.Localization, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
08-08 16:38:54.923: E/Unity(21408): at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) [0x00000] in <00000000000000000000000000000000>:0
08-08 16:38:54.923: E/Unity(21408): at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00000] in <00000000000000000000000000000000>:0
08-08 16:38:54.923: E/Unity(21408): at UnityEngine.ResourceManagement.Util.LRUCacheAllocationStrategy.New (System.Type type, System.Int32 typeHash) [0x00000] in <00000000000000000000000000000000>:0
08-08 16:38:54.923: E/Unity(21408): at UnityEngine.ResourceManagement.ResourceManager.CreateOperation[T] (System.Type actualType, System.Int32 typeHash, System.Int32 operationHash, System.Action`1[T] onDestroyAction) [0x00000] in <00000000000000000000000000000000>:0
08-08 16:38:54.923: E/Unity(21408): at UnityEngi
08-08 16:38:54.951: E/Unity(21408): MissingMethodException: Default constructor not found for type UnityEngine.ResourceManagement.ResourceManager+CompletedOperation`1[[System.Collections.Generic.IList`1[[UnityEngine.Localization.Locale, Unity.Localization, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
08-08 16:38:54.951: E/Unity(21408): at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) [0x00000] in <00000000000000000000000000000000>:0
08-08 16:38:54.951: E/Unity(21408): at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00000] in <00000000000000000000000000000000>:0
08-08 16:38:54.951: E/Unity(21408): at UnityEngine.ResourceManagement.Util.LRUCacheAllocationStrategy.New (System.Type type, System.Int32 typeHash) [0x00000] in <00000000000000000000000000000000>:0
08-08 16:38:54.951: E/Unity(21408): at UnityEngine.ResourceManagement.ResourceManager.CreateOperation[T] (System.Type actualType, System.Int32 typeHash, System.Int32 operationHash, System.Action`1[T] onDestroyAction) [0x00000] in <00000000000000000000000000000000>:0
08-08 16:38:54.951: E/Unity(21408): at UnityEngi
Are you using stripping? It wonât work with code stripping at the moment due to a bug with SerialiseReference.
Have you built the addressable assets?
I disabled strip engine code but no help. I am not using addressable assets. just addressables added by Localization Package. I donât know much about addressable So, I never touched anything related this.
To use Localization in the player you need to build the Addressables. Windows/Asset Management/Addressable/Groups.
Click Build at the top and build player content. Now build the android game and it should work.
Sorry to disturb you again but which one is player content? there is New build, Clean Build, Update a Previous Build and many options inside those Builds.
Try doing a new build.
Thank you so much, It finally worked now. But when I am restarting game language setting back to English. How to save selected language?
What does your Localization settings look like? Click the + button for the locale selectors. I think thereâs one called player Prefs selector. Drag that to the top.
FYI: on 0.7.1.preview it doesnât seem to be added by default, which I think would be a reasonable thing to consider doing.
Sorry to bother, but I tried your: ugui sample.unitypackage to see what I was missing in creating a langue selection menu and though it works in unity with no errors on console my visual studio is very angry throwing errors saying that "UI namespace doesnât exist in the namespace âUnityEngineâ. Iâm using unity 2020.3.30f1