Wednesday, November 6, 2024
spot_img

Getting FPS and Draw Calls from Code – Cocos Creator


Hello all!

I’m utilizing Cocos Creator model 3.8.3.

When working within the editor and launching the sport within the browser, I’ve entry to the “Present FPS” button. However after I construct the sport (Internet-Desktop, Internet-Cellular), this button is now not out there. I want to show some statistics (FPS and Draw Calls).

How can I get these values ​​from the code?

On the construct config, you’ll find an choice “Debug”. Test it and construct once more it ought to seem

I find out about this. However this data is at all times proven. And it’s not at all times clearly seen (dimension, shade). I need to have the ability to show FPS and Draw Calls within the location, dimension and shade I want.

You in all probability can use Sport class or Profile class for that. Learn a bit deeper the API docs

On the similar time, the profiler is generated as a node contained in the scene scope, so it’s also possible to attempt to manipulate the weather instantly there

You’ll be able to merely get FPS by deltaTime. In cocos, deltaTime params on replace technique is time between two replace name. So you may get Body Per Second by let 1 / deltaTime.

Eg: my regular deltaTime is 0.016 so my FPS is 1/0.016 = 120FPS.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement -spot_img

Latest Articles