言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

Object.FindObjectsOfType

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static function FindObjectsOfType(type: Type): Object[];
public static Object[] FindObjectsOfType(Type type);
public static def FindObjectsOfType(type as Type) as Object[]

Description

タイプから見つけた全てのアクティブのオブジェクト配列を返します

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