一个查询场景TYPE的函数

function OnMouseDown () {
var hinges : HingeJoint[] = FindObjectsOfType(HingeJoint) as HingeJoint[];
for (var hinge : HingeJoint in hinges) {
hinge.useSpring = false;
}
}

----------------------------------------------------

//将场景中所有模型名写入数组getAllName
var getAllName = new Array ();
function Start()
{
 var hinges : GameObject[] = FindObjectsOfType(GameObject) as GameObject[];
 for (var hinge : GameObject in hinges)
 {
  getAllName.Push(hinge.name);
 }
 print(getAllName);
 print(getAllName.length);
}

function Update()
{
}

你可能感兴趣的:(type)