using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; public class SelectGroup : MonoBehaviour,IPointerClickHandler { public Transform target; public void OnPointerClick(PointerEventData eventData) { GetComponent().isOn = true; } void Update() { if (target != null) { this.GetComponent().position = Camera.main.WorldToScreenPoint(target.position); } } }