X and Y Detail Billboarding

Hey everyone, I’m making a pixel art-stylized 3d game that also uses some 2d sprites for the environment. I drew a simple grass sprite and I want it to always face the camera. The issue is that when I’m trying to use the terrain system with billboarding enabled, it only rotates the sprite on the Y-axis. I’m quite new to unity’s terrain and I have no idea how to change that. I made a simple script that enables billboarding on both X and Y, but I can only add it to objects that I placed manually. It works, but I want to flood my scene with grass, so placing it one by one is not really an option.

What would be the best way to do it?

Alright, I think I figured it out. It’s not ideal but I think there’s no other way to do it.

You need to put your sprite on a quad to make a prefab with a mesh renderer, then add this script and pick the camera in the inspector you want it to look at.

using UnityEngine;
using System.Collections;

public class BilboardXY : MonoBehaviour
{
    public Camera cameraToLookAt;

    void Update()
    {
        transform.LookAt(cameraToLookAt.transform);
    }
}

Then you need to add it as your tree brush instead of detail. If you want to keep the swaying effect you need to make a shader for your quad but that’s about it. It’s probably not the best for performance but it seems that if you want to use terrain tools there is no other way to have control over your grass.