Is there any easy way to use localization for GameObjects using NGO?
For example I have a GameObject with attached dialogue (inclunding text and audio clips) in English and the same in German. Can I somehow activate and deactivate these game objects dependent on the PlayerPrefs?
Use the Localization package to localize your strings and assets.
Localization should not depend on Netcode in any way. You would check on the client side what the user’s (default or selected) language is and then use the Localization package features to create a string.
And for assets you make those interchangeable simply by replacing the sprite or mesh on the renderer of a network object, or the renderer’s material.
You cannot change the network object itself, ie spawn language-specific objects depending on client’s locale. While such a system could be imagined and implemented, it would be super inefficient as you’d have many more network objects. Say 4 clients each with a different language would have you spawn each object four times for all clients, except then you’d hide three of them locally.
This makes sense, thanks! I was thinking to have all of the objects in the scene and activate or deactivate them dependent on the selected language. This seems for me to be the easiest option in my case. Otherwise I must rebuild the entire dialogue system. But I am not sure if I will get performance issues activating and deactivating them all of the time. What do you think?
I would not use separate objects for localization. You really only need to replace the text, and perhaps sprites or textures and such. This is not only more efficient, it also prevents any bugs from occuring.
Imagine what would happen if multiple localized objects got enabled at the same time, or none. Or if they had different components on them. And so on.
1 Like
I know you are right… this means code refactoring
That‘s life for a software developer. Refactoring is our bread and butter.