FindObjectsOfType()

代码演示:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FindObjectOfType : MonoBehaviour {

private GameObject[] things;
private GameObject thing;

void Start () {

things = FindObjectsOfType<GameObject>();
thing = FindObjectOfType<GameObject>();

Debug.Log("第一个" + thing.name);
for(int i = 0; i < things.Length; i++)
{
Debug.Log(things[i].name);
}
}
}
--------------------- 

上一篇:Things 3 for Mac是什么?如何使用?


下一篇:一分*领袖平台最高邀请码22110100