One way to find these values in Unity is to use the method Update()
, it is inside the tool and is called each time a frame is created.
To know the total number of frames that were generated, we can create a variable and add 1 to each method call.
int frame; //total de frames criados
Update(){
frame++;
}
And to know the fps
we can take the inverse of the time variation between each call
float deltaTime = 0.0f;
float fps = 0.0f;
void Update()
{
deltaTime += (Time.deltaTime - deltaTime) * 0.1f;
fps = 1.0f / deltaTime;
}
You can use these variable values and work as you like.
About the Update function https://youtu.be/0rD4OuPxsuk?t=10m19s
Some FPS implementations in Unity: http://wiki.unity3d.com/index.php?title=FramesPerSecond
When you say you need to capture how many frames a scene is using, do you want to know the total number of frames accumulated in the complete execution of the scene, or how many frames are produced per second? Well, in both cases the path is the same, in the function
Update()
, it is called every new frame created, and only change the implementation according to what you want. examplefps = 1.0/Time.deltaTime;
https://youtu.be/0rD4OuPxsuk?t=10m19s– Nils
@Nils, create an answer with that content. :)
– Luiz Vieira