Lately, I’ve been coding just fine with no hiccups, minus a few bugs with the Unity Engine which I have reported. However, this one is strange.
#pragma strict
...class stuff...
function ApplyToAll (edit : GameObject)
{
var childrenTrans : Transform [] = edit.GetComponentsInChildren(Transform) as Transform [];
if (childrenTrans != null)
{
var skipFirst : int = 0;
for (var child : Transform in childrenTrans)
{
Apply(child.gameObject, false);
}
}
else
{
Debug.Log(edit.name + " has no children!");
}
}
The above has been printing out “GameObject has no children”.
However, when I remove pragma strict and change the line to:
var childrenTrans = edit.GetComponentsInChildren(Transform);
the above code works just fine.
Any ideas?