Speed Effect - Replay Question

Hey guys,

I have two questions, which I think, probably need a similiar approach.

I want to know how can I achieve an effect like this:

where after a really fast movement of the player, “duplicates” of the sprite appear, which get more transparent the further they are away from the hero.

Is there a script or tutorial out there which explains this?

I was thinking that maybe it is possible to save the heros position in a certain rythm (every 0.1 seconds for example), and then show duplicates of the sprite at these positions in different transparency levels.
But how can I do that?

Another question would be:
A replay function, as for example like Super Meat Boy, where at the end of the level, the game plays back with all previous deaths at the same time.

like this:

Again, a possible explanation for this would be saving the positions of the hero at runtime, probably even at every frame.

But wouldnt this be a bit too heavy for a mobile device, saving the heros position at every frame?
Is there something I miss. Or is there an asset which explains this?

I would be really thankful for any help on this topic

Thanks

Seems like you answered your own question already. It’s basically a variant trail effect. You can do it with a queue of sprites, putting in new ones with some frequency and discarding the old ones (or better, reusing them).

A common approach for replays is to only record user input and replay that.

I would say make a prefab with a sprite animation that display the hero sprite and fade out to transparent.

Then you have a pool of several prefabs like this. In every certain seconds, request one prefab from the pool and put it at the hero’s location, let it play the sprite animation. After animation is finished return the prefab into the pool.

but how exactly can I save such a big load of information (positions in every (other) frame)?

you don’t need to save them, you just put the “shadow” prefab at the position of the hero, every certain seconds or frames.
and have a script in the “shadow” prefab, that after the fade out animation is finished, it will remove itself from the screen. (actually just go off screen, we usually call this “return to the pool”)