Random object from GameObject.FindGameObjectsWithTag?

Hello. Basically I have a series of objects in my scene, all with the same tag, "White".

I want to randomly pick one from this series, and using GameObject.FindGameObjectsWithTag I managed to create a list of the said objects. This "list", as the Unity Script Reference calls it, is apparently not an array, because if I try to assign a variable to a random member of it it gives me an error.

listWhites = GameObject.FindGameObjectsWithTag("White");
var i = Random.Range(0,listWhites.length);
var theObject : GameObject = listWhites*;*
*```*
*<p>Gives me this error:</p>*
*<p>MissingFieldException: Field 'System.MonoType.listWhites' not found.*
*Boo.Lang.Runtime.DynamicDispatching.SliceDispatcherFactory.ResolveMember ()*
*Boo.Lang.Runtime.DynamicDispatching.SliceDispatcherFactory.CreateGetter ()*
*Boo.Lang.Runtime.RuntimeServices.CreateGetSliceDispatcher (System.Object target, System.String name, System.Object[] args)*
*Boo.Lang.Runtime.RuntimeServices+c_<em>AnonStorey1A.<>m</em>_11 ()*
*Boo.Lang.Runtime.DynamicDispatching.DispatcherCache.Get (Boo.Lang.Runtime.DynamicDispatching.DispatcherKey key, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)*
*Boo.Lang.Runtime.RuntimeServices.Dispatch (System.Object target, System.String cacheKeyName, System.Type[] cacheKeyTypes, System.Object[] args, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)*
*Boo.Lang.Runtime.RuntimeServices.Dispatch (System.Object target, System.String cacheKeyName, System.Object[] args, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)*
*Boo.Lang.Runtime.RuntimeServices.GetSlice (System.Object target, System.String name, System.Object[] args)*
*init.Generate () (at Assets/init.js:60)*
*init.Start () (at Assets/init.js:21)</p>*
*<p>Any idea on how to do this? Thanks in advance, and sorry for the bad english</p>*

Try this:

listWhites.Length

This "list", as the Unity Script Reference calls it, is apparently not an array

The list is definitely an array. I would guess you're using the wrong type, but since you haven't included all of the relevant code, I can't say for sure. It's not Array, it's a GameObject array, as specified by the docs (look at the return type).

You must add this after declaring list whites "[]" Like shown below

listWhites[] = GameObject.FindGameObjectsWithTag("White");
var i = Random.Range(0,listWhites.length);
var theObject : GameObject = listWhites*;*
*```*