Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Weird result with camera scaling

Discussion in 'Scripting' started by dinizthiagobr, Aug 2, 2015.

  1. dinizthiagobr

    dinizthiagobr

    Joined:
    Jul 19, 2015
    Posts:
    3
    I'm designing this game based on a 800x600 resolution screen and this is what it looks like:




    When I select a different resolution, this is the result:



    I don't want to have that empty space, so I changed the width of my Camera Viewport Rect with this code:

    float idealAspect = 800f / 600f;
    float aspect = (idealAspect / ((float)Screen.width / Screen.height));
    Camera.main.rect = new Rect (0, 0, aspect, 1);

    It works fine when running the game inside Unity, but when I run directly on my phone (Moto G 2nd gen.), this is the result:



    Any idea on how to fix this?

    Thanks.
     
  2. dinizthiagobr

    dinizthiagobr

    Joined:
    Jul 19, 2015
    Posts:
    3
  3. dinizthiagobr

    dinizthiagobr

    Joined:
    Jul 19, 2015
    Posts:
    3
    well I'm still lost so lol.