- Home /
Loading Cards with different langauges
Hello guys,
So in my 2D card game, i have two set of cards ( differs in language).
Right now, I directly fetch them using arrays:
public Sprite[] CardsEN;
public Sprite[] Cards;
In the same class, i choose a card depending on the "Language" parameter like that:
Sprite getCard( int index)
{
if ( Language == "EN")
return CardsEN [index]
else
return Card [index]
}
I think this is not the best scenario as one set of card is on memory without being used. So how can i use memory in an efficient way here?
Thank you.
Probably the thing that is different from an EN card and a normal one is the text. You could leave a blank space and write the text at runtime (take a look at the now free Text$$anonymous$$eshPro).
If you can't separate the text (you have the text inside the sprite) you could keep card packs in different "language" prefabs and instantiate them based on the chosen language.
If the size of the game distributable is an issue, then you could generate the cards at runtime by sticking sprites that contain only the text in the blank place of the cards that contain the images. Think of it as applying a sticker on a blank text card. You could do this in bulk at the start of the application.