Returns a list of all active loaded objects of Type type.
// When clicking on the object, it will disable all springs on all
// hinges in the scene. function OnMouseDown () {
var hinges : HingeJoint[] = FindObjectsOfType(HingeJoint) as HingeJoint[];
for (var hinge : HingeJoint in hinges) {
hinge.useSpring = false;
}
}
using UnityEngine; using System.Collections; public class Example : MonoBehaviour { void OnMouseDown() { HingeJoint[] hinges = FindObjectsOfType(typeof(HingeJoint)) as HingeJoint[]; foreach (HingeJoint hinge in hinges) { hinge.useSpring = false; } } }
import UnityEngine import System.Collections public class Example(MonoBehaviour): def OnMouseDown() as void: hinges as (HingeJoint) = (FindObjectsOfType(typeof(HingeJoint)) as (HingeJoint)) for hinge as HingeJoint in hinges: hinge.useSpring = false