Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Why when changing resolution while game running using the exe built file everything is too blurry ?

Discussion in 'UGUI & TextMesh Pro' started by Chocolade, Dec 2, 2019.

  1. Chocolade

    Chocolade

    Joined:
    Jun 19, 2013
    Posts:
    932


    The default resolution is 1920x1080 and the ui elements are sharp and fine. Once I changed the resolution to 640x480 but it's the same on other resolutions either everything get blurry and the buttons are not responding all I can click on is the RESOLUTION dropdown and change the resolution and if I will change it back to the defalut 1920x1080 then everything will be looking sharp again and I will be able to click on the buttons and change all other ui's.

    How can I fix it so on any resolution it will looks sharp and also will respond ?

    This is how it looks like on the default 1920x1080 :



    This is my Main Menu hierarchy :




    And this is the script that attached to the Canvas :

    Code (csharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5. using UnityEngine.Audio;
    6. using UnityEngine.UI;
    7.  
    8. public class SettingsMenu : MonoBehaviour
    9. {
    10.    public AudioMixer audioMixer;
    11.    public Text volumeInPercentages;
    12.    public Dropdown resolutionDropDown;
    13.  
    14.    [SerializeField]
    15.    private Slider _volumeSlider;
    16.    [SerializeField]
    17.    private Dropdown _dropDownQuality;
    18.  
    19.    private Resolution[] resolutions;
    20.  
    21.    private void Start()
    22.    {
    23.        resolutions = Screen.resolutions;
    24.        resolutionDropDown.ClearOptions();
    25.  
    26.        List<string> options = new List<string>();
    27.  
    28.        int currentResolutionIndex = 0;
    29.        for (int i = 0; i < resolutions.Length; i++)
    30.        {
    31.            string option = resolutions[i].width + " x " + resolutions[i].height
    32.                 + " " + resolutions[i].refreshRate.ToString() + " Hz";
    33.            options.Add(option);
    34.  
    35.            if (resolutions[i].width == Screen.currentResolution.width &&
    36.                resolutions[i].height == Screen.currentResolution.height)
    37.            {
    38.                currentResolutionIndex = i;
    39.            }
    40.        }
    41.  
    42.        resolutionDropDown.AddOptions(options);
    43.        resolutionDropDown.value = currentResolutionIndex;
    44.        resolutionDropDown.RefreshShownValue();
    45.    }
    46.  
    47.    public void SetVolume()
    48.    {
    49.        float volume = _volumeSlider.value;
    50.        Debug.Log("Volume " + volume);
    51.        audioMixer.SetFloat("MusicVol", Mathf.Log10(volume) * 20);
    52.        volumeInPercentages.text = Mathf.Round(volume * 100).ToString() + " %";
    53.    }
    54.  
    55.    public void SetQuality()
    56.    {
    57.        int qualityIndex = _dropDownQuality.value;
    58.        QualitySettings.SetQualityLevel(qualityIndex);
    59.    }
    60.  
    61.    public void SetFullScreen()
    62.    {
    63.        Screen.fullScreen = !Screen.fullScreen;
    64.    }
    65.  
    66.    public void SetResolution()
    67.    {
    68.        Resolution resolution = resolutions[resolutionDropDown.value];
    69.        Screen.SetResolution(resolution.width, resolution.height, Screen.fullScreen);
    70.    }
    71. }
    72.  
     
  2. richvic

    richvic

    Joined:
    Jan 18, 2020
    Posts:
    1
    Same Problem
     
  3. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Are you using TMP?

    Please test to see if you get the same results using the latest release of the TMP package which are: Version 1.5.6 for Unity 2018.4, version 2.1.6 for Unity 2019.4 and version 3.0.6 for Unity 2020.x.

    If you still get the same results, switch to using one of the SSD variants of the TMP shaders. Those shaders are located with the other ones in the TMP Essential Resources. They have the suffix SSD in their names.