Displaying a float between two texts

I was wondering if it’s possible to display information from a float between two pieces of the text. I want to have something that says “Camps Burnt X/3”. Right now I have this following code but that just gives me the float at the end of the statement. I know I could just add another text beside this text and put a “/3” in it. However I’m trying to learn and I would like to find the proper way to do this.

    BonusOrders.text = "Secondary Objective: - Burn Goblin Camps " + CampsBurnt.ToString ();

How about using string.Format():

float myFloat = 1.5f;

string text = string.Format("Some Text {0} plus some number", myFloat);

The text string will become: “Some Text 1.5 plus some number”

That way you can place the number anywhere in the string, where ‘{0}’ marks the position that it will be displayed.

1 Like

Thanks for the help. That did the trick.