increment count

I have set a count variable so that each time the player takes a screenshot the count increases like screeshot1,screenshot2 etc but now the output is just screenshot+count+.png…how do i resolve this?this is my code

Application.CaptureScreenshot( "../../../../DCIM/Camera/screenshot+count+.png");
count++;

1 Answer

1

Use the ToString() method and you need to concatenate the string.

Application.CaptureScreenshot( "../../../../DCIM/Camera/screenshot"+ count.ToString() +".png");
count++;

Adding to the answer by T27M, you don't need the .ToString() part because when concatenating strings and integers, the integers are automatically cast into strings. So, this would work equally fine: Application.CaptureScreenshot( "../../../../DCIM/Camera/screenshot"+ count +".png");

–

Ah cool didn't realize that. +1

–

works like a charm

–