This is the situation,when I am running my game with Fantastic quality setting and making the V Sync Count Every V blank,the game seem to run fine,I changed it to Every second V Blank,The game all of sudden seem to run slow,
Then I changed it to no Vsync at all then the game ran very fast.I Checked the profiler and found out that VSync Is taking up the majority of the CPU Usuage.I want to know how VSync works and what they do.
Vertical Sync synchronizes the frame display with the monitor refresh rate. This prevents the “tearing” effect that happens when the game updates a frame in the middle of a screen refresh, and generally makes things run more smoothly.
Syncing isn’t hurting your performance. You aren’t using up the entire time you have available to build the next frame, so your code ends, and then Unity waits for the vertical sync to display it.
Think of it like this. Frank and Bob are both working on something, but once every minute they have to push a red button. Neither can continue doing their job until both have pressed the red button each minute. Frank always finishes his task in 20 seconds and pushes the red button. But Bob always takes the full minute to do his work before pressing the red button.
So each minute, Frank has to wait 40 seconds, idling, doing nothing, until Bob presses the button. Then they both continue on.
Frank is the CPU, Bob is the GPU/V Sync. The CPU gets its work done for the frame and is ready to go, but it must wait for the GPU to “push the red button” before it can continue on and start working on the next frame.
Just wanted to shed more light on this matter, concerning the profiler.
When Quality Settings > V Sync Count is set to an option that is not “Don’t Sync” (Or by code, see reference) Unity will match frame rate to your monitors’ refresh rate (depending on the value you have given Vsync). What you see in the profiler under CPU Usage > Vsync is the time unity waits before rendering another frame. This can be foundin the hierarchy view of the profiler as Initialization.PlayerUpdateTime > WaitForTargetFPS. What this means, basically, that this value is actually positive as it grows larger in percentage.
Note that you will not see valid value if the option of Vsync is turned off from the Quality Settings menu.