Is there a logging method, similar to C#'s Console.WriteLine? (what I want is the {N})

Hello guys,

I was just testing something when I accidentally wrote:

Debug.Log("There are {0} elements in my list", list.Count);

Then I remembered I can’t do that in Debug.Log - And I can’t use Console.WriteLine to output to Unity’s console (can I?)

Is there a way of doing this? Does Unity have a logging method, that supports this? or do I have to try to implement this thing myself? - Not that it’s not doable, but won’t be too easy.

Thanks.

The {N} function used in Console.WriteLine is the same exact thing used in String.Format.

For example:

Debug.Log(String.Format("Hello {0}, you are {1} years old.", name, age));

Use System.String.Format.

Debug.Log (String.Format("There are {0} elements in my list", list.Count));

Debug.Log(“There are " + list.Count + " elements in my list”);