Print arraylist values to console

With the help of info here I created a random unique number generator in an arraylist.

I want to print the arraylist content to my console but I only get this message: System.Collections.ArrayList

If I use .Count or .IndexOf it works.
I can’t find a solution anywhere on the internet. And Unity doesn’t support arraylist in their documentation at all.

Thanks!

My code:

var totalHumans:int = 8;
var aHuman = ArrayList();

function Start ()
{
	while (aHuman.Count < totalHumans)
	{
		var human = Random.Range(0, 17);
		if (!aHuman.Contains(human))
		aHuman.Add(human);
		
	}
	Debug.Log(aHuman);
}

In case anyone is still following up, here is what I use to get a one-line array output

Debug.Log("Human = " +String.Join("",
			new List<int>(aHuman)
			.ConvertAll(i => i.ToString())
			.ToArray()));

You can iterate over the list with something like:

for( var human in aHuman )
{
  Debug.Log( human );
}

I think your’re looking for an Array().

here are all the methods for ArrayList.

i don’t think there is one you seek.

why don’t you add in your WHILE loop something like this:

Debug.Log(“human”+aHuman.Count+“=”+human);