public static Object FindObjectOfType (Type type);


type 見つけるオブジェクトの型


Object This returns the Object that matches the specified type. It returns null if no Object matches the type.


タイプ type から最初に見つけたアクティブのオブジェクトを返します

using UnityEngine;
using System.Collections;

// Search for any object of Type GUITexture, // if found print its name, else print a message // that says that it was not found. public class ExampleClass : MonoBehaviour { void Start() { GUITexture texture = (GUITexture)FindObjectOfType(typeof(GUITexture)); if (texture) Debug.Log("GUITexture object found: " +; else Debug.Log("No GUITexture object could be found"); } }