When trying to use an array as an argument for the string.Format()
method, I get the following error:
FormatException: Index (zero based)
You can convert int array to string array as pass it using System.Linq
Select()
extension method.
infoText.text = string.Format("Player1: {0} \nPlayer2: {1} \nPlayer3: {2} \nPlayer4: {3}",
place.Select(x => x.ToString()).ToArray());
Edit:
In C# 6 and above, you can also able to use String Interpolation instead of using string.Format()
infoText.text = $"Player1: {place[0]}\nPlayer2: {place[1]} \nPlayer3: {place[2]} \nPlayer4: {place[3]}";
Check this fiddle for your reference.