0

I have a Canvas with RenderMode set to "World Space".

I want the Canvas to Look At the main Camera, so i wrote this code:

SimpleCanvas.transform.LookAt(Camera.main.transform);

it works perfect, but i get the error "Null Reference Exception" just like this guy Unity C# : Camera.main returns null?

So i read that you should set your Camera's Tag to "MainCamera". When i do this, the camera no longer returns null, but my Canvas gets rotated by 180 degrees and looks mirrored to the camera.

What can i do to stop the rotation / or get rid of the null Reference Exception?

AlpakaJoe
  • 533
  • 5
  • 24

1 Answers1

0

okay i found the answer by myself ... very easy, i just added:

SimpleCanvas.transform.Rotate(0, 180, 0);
AlpakaJoe
  • 533
  • 5
  • 24