I’ve followed the lesson carefully, but my enemy healthbars keep pointing a wrong direction.
Any idea’s on what I’m doing wrong?
I didn’t change the scripts, but I added a line in the enemy UI script to see whether it finds the camera and if it is looking at it.
print(“i rotate to” + cameraToLookAt.name + "at vector: " + cameraToLookAt.transform.position);
I also added a Gizmo to draw a line from the gamecanvas to the camera, but that line doesn’t start where the UIsocket is, but in the center (0,0,0)
void OnDrawGizmos()
{
Gizmos.color = Color.blue;
Gizmos.DrawLine(cameraToLookAt.transform.position, enemyCanvasPrefab.transform.position);
}