GameObject.FindGameObjectWithTag()

代码演示:

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

}
}

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

猜你喜欢

转载自www.cnblogs.com/liyanyan665/p/11278031.html