I would like to output a list (C# Scripting), which contains elements of objects' names. Since this list is generating dynamacally, I just get a output in every single line. This is my code:
public static List<string> myList= new List<string>();
//...
public static void myMethod (Renderer[] renderers) {
foreach (var renderer in renderers) {
if (IsVisible(renderer)) {
//print (renderer.name + " is visible!");
myList.Add (renderer.name);
}
print (myList);
}
myList.Clear ();
print ("--");
}
The output is like System.Collections.Generic.List'1[System.String]in every line.
After a reseach I also tried
foreach (var item in myList) {
print (item);
}
This method prints every object in a single line. But I want all names of the objects to be together in one line until there will be "--" printed. How can I realize it? Thanks!
Example:
output now:
object0
object1
object2
etc.
what I want to achive: object0, object1, object2, etc.
printa function you have written?printcomes fromusing System.Collections.Generic;Debug.Log(), I'm developing in MonoDevelop for the game engine Unity3D.