using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class TransportButton : MonoBehaviour { [SerializeField] private Image imageButton; [SerializeField] private Button transportButton; Transform location; void LateUpdate () { if (location != null) { if (imageButton!=null) { imageButton.enabled = true; transportButton.enabled = true; } if (Camera.main != null) { transform.position = Camera.main.WorldToScreenPoint(location.position); } } else { if (imageButton != null) { imageButton.enabled = false; transportButton.enabled = false; } } } public void Activate(Transform location) { gameObject.SetActive(true); this.location = location; } public void Deactivate() { gameObject.SetActive(false); } }