I am creating a 2D physics based game that creates a 2d circle on mouse click however when it spawns the plane is always side on to the camera. The other problem i encountered is that using LookAt does not allow me to dictate assign the camera since i am using a prefab.
The above script was still making the plane tilt down at me when I looked up and tilt up when I looked down. I didn’t like this so I changed my approach to:
public class FaceCamera : MonoBehaviour
player = GameObject.FindGameObjectWithTag("Player");
transform.localEulerAngles = new Vector3 (90, player.transform.localEulerAngles.y - 180, 0);
With the above script the billboard only rotates on the y axis relative to the localEularAngle of the players y axis which is the parent to the main camera.
Although, I just reread the OP and it looks like you just need to change the rotation of the plane that instantiates to face your camera…
Set a Quaternion.Eular(x, y, z) variable to 90 degrees in whichever axis you require to make the object face the camera, then use this Quaternion variable in the rotation field when you instantiate your object on click.