Search Unity

Why does my pixel sprite appear differently in the Game view compared to the Scene view?

Discussion in '2D' started by PinkAnigav, Jun 21, 2017.

  1. PinkAnigav

    PinkAnigav

    Joined:
    Jun 21, 2017
    Posts:
    6
    Hello, just a complete noob stressing over something probably worth nothing...

    Please refer to this imgur link for my troubles http://imgur.com/a/KWRSq

    First picture is my Camera setting (just default)

    2nd : Scene view zoomed in

    3rd: Game view zoomed in

    Why does my guy look completely off in the Game view?

    He doesn't even have the eyes anymore in the Game view...

    I created the sprite in Paint.net at 64x128 pixels if it matters.

    Please help me!! Thank you.
     
  2. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    I assume this is due to 'Z fighting', that is all those elements are all at the same Z position, therefore the order they are being drawn will be somewhat random. Change the Z on each of the elements to ensure they are drawn in the correct order. Or better still, change the "Order in Layer" on the sprite renderer to get the order correct!
     
  3. PinkAnigav

    PinkAnigav

    Joined:
    Jun 21, 2017
    Posts:
    6
    Thank you for your answer. I did make a separate layer for the characters and the eyes disappearing is no issue now, but what about the character looking poor in the Game view compared to the scene view?
     
  4. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    You probably didn't need to create a layer, simply changing the order in the layer should suffice.

    The difference in the game view vs scene view may be the active Quality Settings (Edit->Project Settings->Quality) check what's set for Texture Quality.

    Or it may be that mipmaps enabled on the texture import settings for each of the textures. If so turn it off and see if that helps. ( https://docs.unity3d.com/Manual/class-TextureImporter.html )
     
  5. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,343
    @larku is sending you in a bit in the wrong direction, the answer is a lot more simple.

    When you "zoom in" in the scene view the view moves closer to what you're focused on in 3D, or effectively scales the camera view in 2D. When you use the same mouse / keyboard control to zoom in on the game view you're zooming in on the rendered pixels, and not moving the camera. Note the "scale #x" at the top of the game view. It's the same result as if you took a screenshot of your game and then zoomed in on it in a graphics editor. Set that scale back to 1x, then change the Size on the camera component directly to zoom in. You might be able to use the Align with View command if your scene view is where you want your game view.

     
    Last edited: Jun 21, 2017
    PinkAnigav and larku like this.
  6. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Ha, I never noticed he had the game view zoomed (even though he explicitly stated so!!) Well spotted!
     
    PinkAnigav likes this.
  7. PinkAnigav

    PinkAnigav

    Joined:
    Jun 21, 2017
    Posts:
    6
    Thank you so much! And with a super helpful .gif too? You shouldn't have... Just one more question, how can I change the size of the camera component directly? I tried changing the scale from x:1, y:1 to x:0.75, y:0.75 and other drastic changes but has no effect on both the scene view and the game view.
     
  8. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,343
    The gif I stole from somewhere when I was searching for what the command was actually called, but you're welcome. :)

    I actually do literally mean "Size" on the camera component, not scale on the transform (which as you noticed does nothing), but you're probably confused because it's not showing Size anywhere for you.

    Your scene view camera is in 2D mode, which is what you usually want when working with sprites, but your main camera as it exists in your screengrabs, is in perspective mode. I don't do 2D stuff at all, but I had assumed when you aligned the camera with the scene view it would switch from perspective to orthographic (what the 2D scene view uses), but I was mistaken and it keeps the Camera in perspective mode.

    So what you'll want to do is select the camera, change the Projection from Perspective to Othrographic. When you do that the Field of View slider just below the Projection dropdown will change to Size. Now you can modify that, easily, plus in the scene view if you zoom out there when you have the camera selected there'll be a nice box on screen showing where the camera can see and you can manipulate it by the dot handles.
     
    PinkAnigav likes this.
  9. PinkAnigav

    PinkAnigav

    Joined:
    Jun 21, 2017
    Posts:
    6
    This is it! Thank you so much!!!