Object LookAt Camera is inverted

I have some GameObjects (written Numbers) which should look at the camera.

Transform number = carrierGameObjects[i].transform.Find("number");
Transform t = (Transform)number.transform;
Vector3 cameraPosition = Camera.main.transform.position;
t.LookAt(cameraPosition);

That is working well, but the numbers are mirrored. So I tried to rotate the z axis of the cameraPosition:

cameraPosition.z -= 180;

but then the lookAt functionality is stopped and when the camera moves arround the number GameObjects they don’t look at the camera anymore. How can I mirror the objects? (by mirroring I mean, just rotate the object by 180 degrees so I don’t see them from behind)

It looks like you don’t want your numbers to look at camera, you want them to face camera. This is different. Select move tool in unity editor, switch to Local positions mode, and select your digit in scene hierarchy. You will see the blue arrow. When you’re using LookAt method, the object gets rotated to point it’s blue arrow to the position specified. Also note there are multiple rotations available to choose from so you should always specify second parameter for LookAt method.
In order to get your object facing camera all the time, use OnWillRenderObject callback and copy rotation from Camera.current to the object.

This did the trick, without changing anything on the objects in the unity editor:

number.rotation = Quaternion.LookRotation(number.position - Camera.main.transform.position);
5 Likes