タイプから見つけた全てのアクティブのオブジェクト配列を返します
It will return no assets (meshes, textures, prefabs, ...) or inactive objects. この関数は非常に動作が遅いため、毎フレーム使用することは推奨しません。 多くの場合は変わりにシングルトン パターンが使用できます。
// 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 ExampleClass : 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 ExampleClass(MonoBehaviour): def OnMouseDown() as void: hinges as (HingeJoint) = (FindObjectsOfType(typeof(HingeJoint)) as (HingeJoint)) for hinge as HingeJoint in hinges: hinge.useSpring = false