|
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.
Gives me this error: 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_AnonStorey1A.<>m_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) Any idea on how to do this? Thanks in advance, and sorry for the bad english
(comments are locked)
|
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).
(comments are locked)
|
|
You must add this after declaring list whites "[]" Like shown below This is incorrect. You can't use symbols like that in variable names, nor is it necessary in any case.
Apr 18 '11 at 04:56 AM
Eric5h5
(comments are locked)
|
