I get an invalidcast excpetion error here and I can't figure out why. I have a transform variable, and a transform array. I populate the array when it wakes up but when I try to assign the variable to one of the transforms in the array I get an invalidcastexception error. anyone know why?
You're not creating an Array of Transforms, you're creating an Array with one element - the type Transform.
Arrays are always arrays of Objects. You need to cast to Transform a la
respawnPoint = respawnPoints[i] as Transform;
answered Oct 10 '10 at 08:19 PM