Version: 5.5

Object.FindObjectsOfType

Cambiar al Manual
public static Object[] FindObjectsOfType (Type type);

Parámetros

type El tipo de objeto a encontrar.

Valor de retorno

Object[] El arreglo de objeto encontrados que coinciden con el tipo especificado.

Descripción

Devuelve una lista de todos los objetos activos cargados de tipo type.

No devolverá assets (meshes, texturas, prefabs, ...) u objetos inactivos.

Please note that this function is very slow. It is not recommended to use this function every frame. In most cases you can use the singleton pattern instead.

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; } } }