Preparing the Moving Platform Prefab

The moving platform is going to involve some nested GameObjects once again. We’ll construct it in such a way that we can move the whole platform—waypoints and all—by dragging a single root object. Let’s start with the basic setup:

1. Create an empty GameObject and name it “platformMoving.”

2. Create an empty child GameObject under platformMoving and name it “platform.”

3. Create an empty child GameObject under platform and name it “bridgeLogs.”

4. Add a Sprite Renderer Component to the bridgeLogs GameObject and set the “Sprite” property to point to tiles_spritesheet_134.

5. Add a BoxCollider 2D Component to the bridgeLogs GameObject. The default settings should match the sprite accurately.

6. Duplicate the ...

Get Learning 2D Game Development with Unity®: A Hands-On Guide to Game Creation now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.