Devlog 2

Made by: Stefan Vandenboorn

What is the problem I want to solve?

Is it possible to change the language in game without having to build a different version of the game? Should this be done by a custom asset pack from the Unity asset store or does Unity have a solution on its own that can solve this problem?

How will/did I solve this:

(Library and Lab)

By making use of the Unity asset store for finding examples and look up how they are being used I've been looking what the best solution is for our project. Through this I also found out that Unity has his own localization package you can use with a fully documented setup guide:

What is the result?

How I've managed to set this is up is by following the Unity documentation quick start guide for version 2020.3+. I first had to create a Locale in my project, this represents all the available local languages you can select within this project. Then set the default language fallback is in case the other options aren't available. This setup looks like this:

For example, I looked up icons of language flags to use as an example to see if I could make language switch work by visually changing the flag to the corresponding language. To set this up I had to create an asset table collection with the languages I want to use in my project. Then I've added the flag icons to their corresponding language, and in the end it looks like this:

To visualize this in the game scene I've added a raw image that will display these language icons and the localization package has an event script that can do this automatically for you. All I had to do was add this script to this raw image and select the correct asset and it will automatically fill in the rest.

For doing this with the text display, it works in a similar way. The only difference is instead of creating an asset table, I had to create a string table. The setup is similar to what I did in Asset but I had to manually type out the translations for the different language options. The result looks like this:

The setup for displaying this text is the same as what I did for images. The only difference is that it is referencing to a text element rather than a raw image.

To be able to switch between these languages I've added a drop down option where I display in the different language options that are available according to the available local languages I've set up in the beginning. I've added a script to the canvas and used the example code from Unity to switch between them in game. This is how the code works:

What is the quality of the result?

I've showed my end result to my teammates and they were quite happy with the result. I've explained to them how this was setup and that you only have to add changes in only one location which makes it more manageable. They ask me if I could document this for them so they also know how to implement this in case the person in charge of it isn't currently available.

What is the next step?

Now that I know that this is a solid solution to use for our project, the next step I want to try is to remove the drop down option and replace this with buttons. If this works I could try and replace the buttons with the language icons to improve the visual representation of the language selection.

Last updated