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

Bug Unity Running my Build in Low Resolution?

Discussion in 'General Graphics' started by meloyaki, Aug 26, 2022.

  1. meloyaki

    meloyaki

    Joined:
    Aug 19, 2022
    Posts:
    2
    Hi devs, this wasn't always an issue but making a simple 2d game, I somehow provoked an issue where Unity is building and running my game in a low resolution...

    fixes?
    I've combed through both my code, build settings, and camera/canvas settings = they all point toward my game running in 2560 x 1440 (also my monitor res)

    My code: any code I have regarding Display and Screen is a super simple startup code I made in a second.
    I made it for redundancy, with or without this code the screen is always blurry.

    Code (CSharp):
    1. Screen.SetResolution(2560, 1440, true);
    The two attached images are my (low) resolution build, and a brand new project built and ran, (normal) res.​
    Screenshot 2022-08-26 140112.jpg Screenshot 2022-08-26 140439.jpg
    I've been at it for a few days so any ideas or help would be greatly appreciated. <3​
     
  2. meloyaki

    meloyaki

    Joined:
    Aug 19, 2022
    Posts:
    2
    More details: This all started when I had wanted to make a settings menu, the code I wanted to use would not cooperate with my camera/canvas rendering options and I changed a few things and the code was still broken, since then, I had deleted the code and forgot what I set to cause this issue...

    my old code had involved finding display size > setting screen size. + a bunch of preset sizes to pick from in settings. and a seperate code involved toggling windowed and fullscreen modes. This was all scrapped and is no longer in the game.
    Could it be possible that the code somehow permanently changed Unity's startup resolution??

    If I were to mock up a rough(and unlikely to run) rendition of my scripts they would look like this.
    Code (CSharp):
    1. public class ResolScript : MonoBehavior
    2. {
    3.  
    4. // for a (auto detect resolution) button in settings
    5. void AutoDetectRes()
    6. {
    7. Screen.SetResolution(Display.systemWidth, Display.systemHeight, true);
    8. }
    9.  
    10. //preset resolution buttons
    11. void TwokRes()
    12. {
    13. Screen.SetResolution(2560,1440, true);
    14. }
    15.  
    16. void TenEightyRes()
    17. {
    18. Screen.SetResolution(1920, 1080, true)
    19. }
    20.  
    21. //for fullscreen, windowed toggle, Not sure how I did this part
    22. //but I know I used the FullScreenMode method,
    23. //Im going to guess how my monkey brain did it the first time.
    24.  
    25. void GetFullscreen()
    26. {
    27. FullScreenMode.FullScreenWindow(Screen.currentResolution, true)
    28. }
    29.  
    30. void GetWindowed()
    31. {
    32. FullScreenMode.Windowed(Screen.currentResolution, true)
    33. }
    34.  
    35. }
    This code was for in-build buttons, the buttons would wonk out and do things like not reflect the proper resolution, the resolution was often low, and the fullscreen/window toggle wouldn't toggle properly (upon using my brain it may be because they are toggles, bools, and not single executables, like a button should be.)

    PERHAPS They toggled a resolution state in which I never UNTOGGLED before I deleted the script?? is that possible gang?
     
    Last edited: Aug 27, 2022