Cap the framerate?

Hi :slight_smile:

Is it possible to cap the framerate in PlayCanvas? We would like the game to run at the same framerate on all devices, but older mobile devices are only capable of running it at 30 fps. Can we force faster devices to run it at 30 fps as well?

I’m basically looking for something similar to how you can set the target framerate in Unity.

Thanks! Weird that I didn’t come across that topic during my search :thinking:

Actually, the code proposed in that topic throws a bunch of errors in our game.

Uncaught TypeError: Cannot set property 'aabb' of null
    at BatchManager.update (playcanvas-stable.dbg.js:44807)
    at BatchManager.updateAll (playcanvas-stable.dbg.js:44820)
    at Application.render (playcanvas-stable.dbg.js:23748)
    at playcanvas-stable.dbg.js:24087

That’s odd. Do you have batching in your project?

Yes, we’re batching hundreds of background objects.

Just to check, if you have this code in your project with a FPS of 60, does it work?

I would also true to have renderNextFrame set to true for the first frame to see if that helps.

Otherwise, there’s a bug with renderNextFrame and batching in the render call.

Without debugging, I could actually believe there may be some incompatibility with batching and autoRender set to false…

If undone already may I suggest using a separate script to apply this? Sorry if this is no help whatsoever