Application.targetFrameRate doesn’t work in the editor. Is that where you are testing it?
Also, the maximum screen refresh rate is 60 FPS in iOS, so you should set it to 60 or a number that can be multiplied by an integer to get 60 (30, 20, 15, etc.). That way your screen is updated every screen refresh or at a consistent number of refreshes.
The Unity iOS default is 30, so you do not need to set it if that is what you want.
Thanks guys. I solved the problem. It seems to work perfectly fine when attached to an empty gameObject but when attached to the camera it does work. Thanks for your help.
Nothing works. Everything I do gives 60 fps locked on v-sync. I can SEE v-sync in the damn profiler.
60 fps and nothing else. Unity is LOCKED and FORCING v-sync. I have tried Application.targetFrameRate = -1, turning off v-sync in quality, turning it off in the code (post above) turning it off at the video card level… I still see v-sync in full action in the profiler (the big thick yellow bar of death, she who locks me at sixty, she who will not relent, etc) and I CANNOT turn it off yet desperately need to.
Why is something so simple ABSOLUTELY impossible with Unity?! This is extremely shoddy and from the forums no one has a solution AT_ALL. If it works for some of you - great - but it generally doesn’t work at all, since a lot of people complain about this. It’s not good when it applies to a few single obscure hardware configs. This needs to work for everyone. Currently v-sync does whatever the heck it bloody pleases.
Can I get this junk to relent? I’m using Radeons 6970, 7870 and 8750M… same garbage on all of them. On the 8750M it’s so pathetic I can’t even turn off THE BUFFERING… I’m developing for Virtual Reality, needless to say buffering is equivalent to physically assaulting your player by reaching into his stomach and pulling the contents out.
Seriously Unity… seriously. This v-sync control works like junk.
Just in case anyone goes full-retard on this issue and starts poiting to a bunch of random things when people like us bring up this major, major bug: here are a few screenshots showing how this engine is clearly broken when it comes to v-sync and IGNORES what the user has set.
Even the profiler here shows it clearly “F*** you developer, I’m syncing no matter what you say”, just like a good stubborn piece of junk. Meanwhile Portal 2 running off Valve Source runs normally like any engine should. Also screenshot that just to make sure people don’t try to get cute asking “Did you (insert condescending obvious thing to check here)”.
This issue has gotten me fed up. VR is extremely buffer sensitive. V-Sync buffers. It renders VR unusable. Unity, the best option to develop for the Rift, is now unusable… for the Rift. Sad. V-Sync = VR cancer. This engine is as good as non-existent for me.
Yes, you would be correct. At that point honestly I was thinking f* it
Ok, here’s the scoop. This is after all NOT Unity’s fault. However this was NOT easy to notice despite its not being that very much hidden. I noticed that going vSyncCount=0; in ANY update function would finally solve the issue.
HOWEVER, if it was in a Start() function, no go. This could only mean one thing. The opposite is being called somewhere else, right? Well I couldn’t recall for the life of me having done this myself. On the other hand a lot of us (in my case, totally) get libraries either off the asset store or for some specific support, in my case the OVR libs for example.
I immediately realized some of the imported library code MUST be calling the opposite… vSyncCount=1… so I ran a search through the entire bloody project folder and sure enough, I found the culprit. Furthermore it so happens I have a fellow developer, not doing VR, who also had the problem due to another lib, also not written by himself but rather imported. I helped him fix his problem while I was at it. A crusade against v-sync if you may
Bottom line if the vSyncCount is being altered somewhere else and you’re not aware of it… DUH… for sure you’re gonna have problems. I promptly took OUT the bloody call and put in my own single vSyncCount=1in a Start() function like it should be and - voila. Finally. The app can unleash insane 450fps rates and oddly enough without an ounce of screen tearing (also detrimental to VR but less so than input lag).
What really stunned me here is that even through the video card’s own “Do not ever V-Sync” option, v-sync would still take effect. That part I still don’t get - it should override and doesn’t. Is it Catalyst? Is it Unity? Not sure at this point.
All in all to save everyone this wild goose chase… just run a bloody search through your whole project folder for either targetFrameRate or vSyncCount and likely you’ll find a lib you imported from the outside to contain the call somewhere, setting it to a value you’re not expecting.
Boy am I glad this was resolved. The difference for VR is day and night. So smooth without the frame cap.
I am facing the issue where the same source code running on Unity editor of Window machine vs Mac machine, leading to 2 different FPS, one is 30, one is 60, already turn off vSyncCount. Have anyone had idea why?
Man, i was hoping this would solve my problem but didn’t. I just want to set my frame rate at a fixed 60 fps. Why is that so hard? I’m also checking the fps from the “stats” window in the game window. I hope that’s actually correct and not just giving me the refresh rate of the card or monitor. I tried putting the QualitySettings.vSyncCount = 0; and Application.targetFrameRate = 60; in my update functions and no go. Tried doing this on game objects and main camera. nothing. Tried searching through my project for calls for these settings and found nothing. Any guidance would be appreciated.
I’d like to mention too that “graphy” on the asset store is a great free way of monitoring frame rates.
@shakenbake check out your profiler as well, should give you some more info on what’s happening, ie. if the game is struggling to hit 60 or if “WaitForTargetFPS” is even appearing
Note btw that for example in the nVidia driver on PC I can still force vsync, no matter what the application (Unity) says. So also in that case, it’s not really Unity’s fault. Setting vsync is not really the realm of application programmers other than a single call to a driver. Hard to make bugs in such a call.