using UnityEngine;
using UnityEngine.UI;
using TMPro;

public class rayInfoUI : MonoBehaviour
{
    TextMeshProUGUI infoText;

    // Start is called before the first frame update
    void Start()
    {
        infoText = transform.GetChild(0).gameObject.GetComponent<TextMeshProUGUI>();
    }

    public void updateInfo(string info,Vector3 infoPosition, Color infoColor)
    {
        infoText.text = info;
        infoText.color = infoColor;
        transform.position = infoPosition;
        Vector3 v = Camera.main.transform.position - infoPosition;
        v.x = v.z = 0.0f;
        transform.LookAt(Camera.main.transform.position - v);
        transform.Rotate(0, 180, 0);
    }
}
