I’ve done some searching and can’t seem to find any examples of this.
I have a variable called ‘waveLevel’.
I want to change my GUI to read “Wave: 7/25” where 7 would be the variable ‘wavelevel’.
Currently my code looks like this;
function UpdateHUD ()
{
waveText.text = "Wave: " +waveLevel; //updates the current waveLevel to the wave GUI
resourceText.text = "" +resourceCount; //updates the current healthLevel to the health GUI
petfoodResourceText.text = "" +petfoodCount;
}
But obviously that would just displaying “Wave: 7” and not the desired “Wave: 7/25”. This is probably a simple question with a very simple answer. Sorry in advance for not being able to find this on my own.
I know this question is super old, but it’s the first result when researching this problem so I thought I would add this for anyone coming across this in the future.
You can actually include variables in your string really easily by adding a ‘$’ before your string, and using ‘{ }’ around your variable, like this:
MyString = $"Here is some text, and this is a variable {VariableName}, without using any + breaks!";
So in the context of this question, you would do something like: