Search Unity

Bug Screen resolution Bug on editor

Discussion in 'Editor & General Support' started by abarcacrespom, Mar 17, 2023.

  1. abarcacrespom

    abarcacrespom

    Joined:
    Feb 1, 2020
    Posts:
    10
    Im making some code for UI animations and i need the screen width to make it work ricght. The code its this little thing:

    var scaleX = Screen.width / m.width;
    var scaleY = Screen.height / m.height;

    It works allright the first time i invoke the method, but the first time its bugged and the screen width value its changed even if i dont touch the game window resolution.
    upload_2023-3-17_13-59-21.png
    As you can see in the image, the screen value (Screen.width) has changed, bug im playing on fixed resolution 1920x1080
    upload_2023-3-17_14-0-21.png
    The bug only happens on editor, it works well on builds, but i want to reset my animations for testing on the editor instead of having to reset the game. Its this a bug or can i solve this with something?