首页 > 技术文章 > GameObject.FindGameObjectWithTag()

liyanyan665 2019-07-31 17:51 原文

代码演示:

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

public class TagFind : MonoBehaviour {

private GameObject thing;
private GameObject[] things;
void Start (http://www.my516.com) {

things = GameObject.FindGameObjectsWithTag("Player");
thing = GameObject.FindGameObjectWithTag("Player");

Debug.Log(things.Length);
Debug.Log(thing.name);

}
}

--------------------- 

推荐阅读