framerate

hi,

i have a simple question:

i want to limit my framerate to 60 fps.
i use:
Application.targetFrameRate = 60;

but its wierd…
i make a test scenen with a rotating cube:
transform.Rotate(Vector3.up * 3);
and the cam+mouselook.
IF i move my mouse it starts to rotate much faster.
if i dont touch my mouse its normal and @ 60 fps.

im using the FPScount script fom the wiki.

and this is happening if im starting the .exe

so how does Application.targetFrameRate work?
does it work?

update:

ok lol still wierd:

if i move my mouse the fps go UP

if i use Screen.lockCursor = true; my fps goes to ~80 if i move the mouse.

without Screen.lockCursor = true; i have 125 fps

lol?

edit: and fps go up to ~ 70 if i only click the leftmousebutton…

Targetframerate does nothing in the editor, it only works on builds.

this happens in the builds…of course

Never rely on your application running at a particular frame rate. You can target it all you want but at the end of the day you have little to no control over how many cpu cycles the operating system will actually assign to you process.

To make sure the movement isn’t frame rate dependent, simply multiply by Time.deltaTime each frame.
eg

transform.Rotate(Vector3.up * 3 * Time.deltaTime);

If you really need the limit to 60fps, you should check the “Sync to VBL” check box in the Quality settings for the application. This will sync the frame rate to the refresh rate of the monitor, which is generally 60Hz on LCD monitors, however this number will improve over time, and is also a lot higher on CRT monitors.

thx for ur reply,
seems like i have to do what u say.

but rly. out of interest. why is Application.targetFrameRate working so bad?^^