- Home /
Can't reference Camera in Prefab
I tried referencing MainCamera to prefab and HealthBar's didn't rotate to MainCamera. But when I try referencing MainCamera to every instance of that prefab, Health bars are rotated to MainCamera. Apologize for my grammar and lack of coding intelligence. Here is my code.
using UnityEngine;
public class BillBoard : MonoBehaviour
{
public Camera cam;
void LateUpdate()
{
transform.LookAt(transform.position + cam.transform.forward);
}
}
Comment
Best Answer
Answer by neganoob · Jun 18, 2020 at 01:49 PM
I just find Camera by adding it the tag called "Camera" and find it instead of referencing the Camera