Search Unity

Changing V-SYNC count doesn't change it in quality settings

Discussion in 'General Graphics' started by Frasski, Jan 6, 2020.

  1. Frasski

    Frasski

    Joined:
    Aug 28, 2018
    Posts:
    3
    Hi,

    So I'm making an options menu for my game, but for some reason, changing the VSYNC count doesn't actually change it in the settings. I have no errors, or anything so I'm really confused why it's not working. I have a toggle switch button that cycles between ON/OFF with the VSYNC count of 0/1. I don't know if I'm stupid or what's going on so I need someone else to take a look at this. Many thanks!

    Script for the button:
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.UI;
    5.  
    6. public class toggleVSync : MonoBehaviour
    7. {
    8.     public Text textToChange = null;
    9.     public int counter = 0;
    10.  
    11.     public void changeText()
    12.     {
    13.         counter++;
    14.         if (counter % 2 == 1)
    15.         {
    16.             QualitySettings.vSyncCount = 0;
    17.             textToChange.text = "V-SYNC: OFF";
    18.         }
    19.         else
    20.         {
    21.             QualitySettings.vSyncCount = 1;
    22.             textToChange.text = "V-SYNC: ON";
    23.         }
    24.     }
    25. }
     
  2. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,278
    What do you mean by "change it in the settings"? Do you mean you don't see the change in the quality settings window? Cause I don't think it's supposed to do that. As far as I know, the quality settings window just displays "presets".
     
  3. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,461
    The settings shown in the inspector are the settings your app starts with. Changing the settings here via API changes the runtime settings, not the defaults you can see in the inspector. It's like making a modification during Playmode not being retained when you leave Playmode.
     
    joshcamas likes this.
  4. Frasski

    Frasski

    Joined:
    Aug 28, 2018
    Posts:
    3
    Yes, and it displays a bunch of other settings as well.
     
  5. Frasski

    Frasski

    Joined:
    Aug 28, 2018
    Posts:
    3
    Some guy was able to do that though?
     
  6. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,278
    So is your goal to change the defaults?