weijia_yu
weijia_yu

Reputation: 1015

Unity3D in game recording algorithm

I wonder how does the recording algorithm work.

My initial thought is getting texture from LateUpdate() every frame.

Supposed my target frame rate of video is 30fps, if my game runs at 60fps, and I only captured the first 30fps, then the problem is I will lose some frames.

If my game runs at 20fps, I dont have enough frames for 30fps video, so should I copy 10 times of the 20th frame?

Is there an tutorial about to start? I searched online but hardly can find a related good tutorial.

Upvotes: 0

Views: 543

Answers (1)

Umair M
Umair M

Reputation: 10740

If you want fixed capturing frame rate, you can user FixedUpdate(). You can set FixedDeltaTimevalue to dermine capturing framerate:

[Range(1,60)]
public int capturingFrameRate = 30;

void aStart()
{
    Time.fixedDeltaTime = 1 / capturingFrameRate;
}

void FixedUpdate()
{
    //capture frame
}

Reference : FixedDeltaTime

hope this helps

Upvotes: 1

Related Questions