2

enter image description hereAfter noticing my game was quite jittery when building it to my iOS device I checked the profiler and found out that vsync was responsible. After a little of research I figured in order to resolve the jitteriness of my game I had to set the target frame rate to 60 as its value was set to 30 by default.

So in one of my scripts in attached to a gameObject in my gameplay scene I I included the code:

void Awake(){
        Application.targetFrameRate = 60;
}

After building my app again I am not sure if this made a difference so I am posting this question to ask how to set the target frame rate correctly as my way seems to not be working...(maybe use qualitysettings.vsynccount although I am not sure if that is meant for iOS)

RaZ
  • 235
  • 1
  • 4
  • 13

1 Answers1

1

You don't need to worry about VSync "using" a lot of CPU in the profiler. I remember I was confused by this. VSync is not causing the performance issues you're having.

You can look at this link for a good explanation: http://answers.unity3d.com/questions/994225/vsync-decreases-performances.html

Also if for some reason you still want to disable VSync, you can do this by going to

Edit > ProjectSettings > Quality

and setting VSyncCount to Dont Sync

If you want to do this using code, I think the following statement also works:

QualitySettings.vSyncCount = 1;
Bhaskar
  • 680
  • 7
  • 26
  • It should be vSyncCount = 0 for Don't Sync. "If this setting is set to a value other than 'Don't Sync' (0), the value of Application.targetFrameRate will be ignored." [Source](https://docs.unity3d.com/ScriptReference/QualitySettings-vSyncCount.html) – sonnyb Apr 08 '20 at 20:57