I record object data (position,rotation) for objects in a scene and store it to a file. At some stage the player can load this file and "play back" the recording to watch themselves. Obviously they can now have a different view. As its trivial to store each frame to a png and then stitch them together as an movie file, I decided to add an export function.
The png sequence is rendered to have 60FPS at the best quality as the render fps does not really matter anymore.
The problem :
Everything else in the scene (clouds/vegetation) is still based on Time.deltaTime. Because it takes much longer to render at ultra and store to an PNG, Time.deltaTime is way off my 60FPS the objects are rendering at. (if that makes sense).
Basically if I render 600 frames, the objects moved for 10 seconds. But everything else moved for the entire render time of 600 frames that will be like 20 seconds. So the backgound looks to be in fast forward.
The question
Is there anyway to set Time.detaTime manually or trick the Unity into setting Time.deltaTime to 1/60 ? Then all the other assets will be in sync with the set FPS and render ?
Ideas
- If I had access to all the assets (including Unit's vegetation) I could hack the code to use a defined time step.
- Not sure if there is some trick with VSync that could help.
Like I said, I am not sure that this can even be done. Any suggestions will be welcome.