0
\$\begingroup\$

I have set up a camera in 2D mode. There is only one camera named "Main Camera", and it is set to "MainCamera" (tag). In console I can see camera's transform position updating, but it isn't moving. And if I adjust field of view for perspective mode, it doesn't take effect.

That is saying, when I hit "Play", the game view is always fixed. In inspector there is no camera preview neither (see image 2).

The only effect I can make to camera is changing the background color.

enter image description here

enter image description here

EDIT:

Main camera is placed right at root. And the camera is supposed to be looking at a small area:

enter image description here

enter image description here

EDIT:

Thanks for DMGreygory pointing out, I'm using default canvas settings and this won't move with camera in play mode. (btw, if not best under canvas, where exactly is suggested to apply those graphics?)

enter image description here

\$\endgroup\$
7
  • \$\begingroup\$ Can you show us two additional views: 1) Your Hierarchy tab, showing whether the camera is inside a parent object (and whether that parent tree has any scaling applied) 2) A view from the 2D scene view mode, so we can see what scene content is supposed to be visible inside the camera's bounds? \$\endgroup\$
    – DMGregory
    Commented Oct 21, 2018 at 16:29
  • \$\begingroup\$ @DMGregory post updated. In play mode I always see the whole panel. \$\endgroup\$
    – knh190
    Commented Oct 21, 2018 at 16:43
  • \$\begingroup\$ "Whole panel" - are those graphics (the blue background and frogs) set up as UI elements under a canvas, rather than sprites in your game's 3D world? If so, show us your canvas settings too. \$\endgroup\$
    – DMGregory
    Commented Oct 21, 2018 at 16:56
  • \$\begingroup\$ @DMGregory they are images. I'm aware only sprites visible in camera, but this doesn't explain why in play mode I can see the images but camera doesn't move. Transform is moving. "canvas setting" do you mean settings under cavas game object? I'm using default. \$\endgroup\$
    – knh190
    Commented Oct 21, 2018 at 16:59
  • \$\begingroup\$ It depends on your canvas mode, which is why I've asked to see how you've configured your canvas. In most modes, the UI in the canvas is overlaid on the screen at the end of rendering, and does not shift according to camera position (so that if you have an ammo counter in the corner of your screen in an FPS, it doesn't slide off-screen when you strafe to the side - it stays locked relative to the screen, not to a world position in the camera frustum). If you want your canvas to act as a worldspace container it needs to be configured specially. \$\endgroup\$
    – DMGregory
    Commented Oct 21, 2018 at 17:02

1 Answer 1

1
\$\begingroup\$

As @DMGregory pointed out in comment, I shouldn't be using default canvas overlay mode. Change that to world space makes camera back to expected behaviour.

enter image description here

\$\endgroup\$
1
  • \$\begingroup\$ Glad you got it fixed! Thanks for sharing your answer. :) \$\endgroup\$
    – DMGregory
    Commented Oct 21, 2018 at 17:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .