2
\$\begingroup\$

I'm trying to profile the game using Unity Profiler in order to catch any potential performance issues. The graphics settings support VSync feature.

However, I am not sure which one is the best practice to have a better profiling insight, having VSync on or off?

\$\endgroup\$
3
  • \$\begingroup\$ I think you shouldn't care about this feature because in many games player can turn on/off this feature (QualitySettings.vSyncCount = 0;).A profiling tool gives detailed information about how our game is performing. If our game has problems, such as low framerate or high memory usage, a profiling tool can show us what is causing these problems and help us fix them.so what you should do is balancing framerate or memory usage and try to find problems.VSync Decreases Performances? \$\endgroup\$ Oct 26, 2018 at 8:19
  • \$\begingroup\$ @SeyedMortezaKamali that looks like an answer to me. :) \$\endgroup\$
    – DMGregory
    Oct 26, 2018 at 23:49
  • \$\begingroup\$ @SeyedMortezaKamali Yea, but the question is do we need to have the VSync enable while profiling? because it might not give us the outcome benchmark we are looking for, and it's not accurate to find the exact spots that cause the performance problems. \$\endgroup\$
    – Emad
    Oct 28, 2018 at 22:30

2 Answers 2

1
\$\begingroup\$

So based on the Unity Diagnosing Performance article disabling the VSync seems like a good practice while profiling the game.

Rule out VSync

Vertical Synchronization, known as VSync, is used to match a game’s frame rate to the refresh rate of the screen it is being displayed on. VSync can affect the frame rate of our game and its effects can show in the Profiler window. If we are not sure what we’re looking at, it can look like a performance problem, so before we go any further we need to learn how to rule VSync out of our investigations.

Hiding VSync information in the CPU usage profiler

We can choose to hide information in the CPU usage profiler graph. This allows us to ignore information that is not useful to our current investigations.

To hide VSync information from the CPU usage profiler graph, follow these steps:

Click on the CPU usage profiler to select it.

In the top part of the Profiler window, where the CPU usage profiler shows its data over time, click the yellow colored square labelled VSync to hide VSync information from the graph.

Disregarding VSync information in the Hierarchy view

There is no way of hiding VSync information from the CPU usage profiler’s Hierarchy view, but we can learn what it looks so that we can disregard it.

Whenever we see a function called WaitForTargetFPS in the Hierarchy view, this means that our game is waiting for VSync. We do not need to investigate this function and can safely ignore it.

Disabling VSync

VSync cannot be disabled on all platforms: many (such as iOS) enforce its use. However, if we are developing for a platform that does not enforce VSync we can disable it altogether in our project while we profile. To disable VSync, open the Quality Settings inspector by going to the top menu bar and selecting Edit **> **Project Settings > Quality. From the drop-down menu labelled VSync Count, select Don’t Sync.

enter image description here

\$\endgroup\$
0
\$\begingroup\$

In Script: QualitySettings.vSyncCount = 0; [Don't sync] QualitySettings.vSyncCount = 1; [Every V Blank] QualitySettings.vSyncCount = 2; [Every Second V Blank]

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Although this information could prove useful to some, it does not answer the question asked. \$\endgroup\$
    – Vaillancourt
    Aug 26, 2021 at 14:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .