change variable from textAsset in dictionary

Hi, i’ve been working in a localization system, i read a txt file from the resources folder, and save it in a dictionary, and i retrieve the value(a string), it works pretty fine, but it’s possible to do something like:
“dummy text” + variable+" more text"
and get the value of the variable from the script?

thanks in advance!

You probably want to prepare your strings for processing via the String.Format method. As an example, you could have the following “Hello” strings in your resource file:

"Hello {0}"
"Hola {0}"

Assuming you load one of those localized strings into a variable named “helloString”, you could insert someone’s name into the string like this:

string finalString = String.Format(helloString, name);

Where “name” contains the players name (for example):

If your string needs multiple “variables”, just include them as necessary. For example, a string like this:

answerString = "Sorry {0}. The correct answer is {1}.";

Could be “filled out” via String.Format like:

string finalString = String.Format(answerString, name, answer);

Where “name” contains the player name and “answer” contains the answer…

The magic is all in the String.Format method. More details can be found here: