- Home /
UI doesn`t render if camera is moved by 1000 units
Hi,
i have a UI which looks like this:
Canvas
->Image
I save this UI as prefab and export it as unitypackage. When i import it in another project and put the UI into the scene the camera doesn`t render it. I found out that i have to use SetParent: (Script attached to Canvas)
transform.SetParent (Camera.main.gameObject.transform, false);
Now the camera renders the UI. My problem is, when i move the camera in the scene far away (1000 units) the camera doesn`t renders it anymore. If i move the camera back the UI appears again.
Is there anything i can do so the problem is fixed ?
Just tested: this problem also appears when i create a new Project, create a new Canvas and an Image in a new Scene. When i press play and move the camera away the UI disappears. I tried to set the Canvas as a child of the MainCamera but it doesn`t help.
Got it. I had to set the canvas to camera overlay.
Tried to set the distance to 2000 at screen overlay but it didn`t changed the "problem". Strange, but well, screen overlay did the trick ty.
Answer by siaran · Mar 27, 2015 at 04:18 PM
have you tried what happens when you increase the camera's far clipping plane? If it happens at 1000 distance it sounds like it may be related to that somehow.
Would be kind of weird if that;s the case though...
Also, is your canvas render mode set to screen overlay, world space, or camera overlay?