I am writing a 2D game in Unity and I want to offer an old-school style title screen demo (such as in Super Mario, etc.) where it shows a brief run through of either one or various levels. How would I accomplish this?

If anyone can either enlighten me or point me to some further reading then it would be very welcome.


The easiest way is to record a play through of the game using some kind of screen-recording software and just play that back. It's probably also the least flexible way, but it would work.

A more interesting solution is to build a record-and-playback feature into your game. These are also known as "replay systems," and you can find quite a few questions about them on here if you search around (try ).

The basic concept is to first record all the input (along with timestamps of that input) as it happens in your game, and save this recording out into a buffer somewhere you can load back up.

Then you load it back up and run the game in a mode where instead of processing input from the actual controllers or keyboards or whatever, you pop an input event off the recorded queue, wait until the appropriate relative amount of time has passed since playback began, and then feed that input to the rest of your game as if the user had simply pressed the correct button.

This often requires you to have a deterministic simulation, so you will find that you'll want to save the random seed used to initialize any random generators with the recording buffer as well, and make sure that everything in your gameplay (that matters) is keyed to that seed so you don't get out-of-sync errors.

Then it's simply a matter of recording a good-enough demo run yourself, saving that buffer as an asset with your game, and then in the "title screen" game state, playing that recording back (probably on a loop of some sort).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.