I have an enemy with a health bar. I need the enemy to rotate without causing the health bar to rotate around itself. I would prefer not to have another, separate movement script for the health bar, so what can I do?
I believe @joss51 is suggesting you create a script on the Health Bar that looks at the Camera. This works in most simple cases, including when the camera moves independently, as might happen in a 3rd person game with detachable camera.
Even if you already have a script on the enemy, you can always add additional ones. The following should work for you:
using UnityEngine;
public class FollowCamera : MonoBehaviour
{
Camera cam;
void Start()
{
cam = Camera.main;
}
void Update()
{
transform.LookAt(cam.transform.position);
}
}