using System;
using UnityEngine;

public class Billboard : MonoBehaviour
{
    public Camera m_Camera;

    private void Start()
    {
        m_Camera = FindObjectOfType<Camera>();
    }

    void LateUpdate()
    {
        transform.LookAt(transform.position + m_Camera.transform.rotation * Vector3.forward,
            m_Camera.transform.rotation * Vector3.up);

        // The next three lines make this work only on the horizontal axis
        Vector3 eulerAngles = transform.eulerAngles;
        eulerAngles.x = -90;
        transform.eulerAngles = eulerAngles;

    }
}
