Moving Platform and Lives

Brennen Witzens
2 min readJan 3, 2022


This article will be about getting a lives system working along side a respawn, as well as a moving platform.

Moving Platform

The moving platform script that I have attached is as above. I have two empty GameObjects as targets for the points in space that I want the platform to move towards ping-ponging back and forth between them. I also have a trigger on the platform itself to have the Player getting set as the Child of the Platform so the player moves along with the platform and doesn’t slide off. When they jump off they’re back to being separated so the player doesn’t get pulled along. Using Fixed Update here allows for no jitter when the player is on the platform.

Next is the lives. It’s similar to the Coins/Collectible that I had set up.

I have a DeathZone trigger down below the entire map and if the player enters it, it sends out an Action that calls this Player Death method. Subtracts a life from the player, updates the UI, then sets the player back to the starting point. Since we’re using gravity, we fall quite quickly, so to make sure we’re able to properly transport the player back to the start position I turn off the Character Controller component briefly. Then have a coroutine turn it back on once everything is in place. If lives is 0 we reload the level.

Quick and easy for today. Next is going to be setting up obstacles. On to the next!