Platforms and switches

If we take a look at the Assets | 2DGameKit | Prefabs | Interactables folder, we will find this kit contains two types of switches:

  • The SingleUseSwitch
  • The ReusableSwitch

Both of them work in the same way, with a small difference as suggested by their names. The first one can be triggered only one time, and the second one multiple times:

We are going to click and drag one single use switch into our scene, and then take a look at the Inspector. The interaction with the switch is managed by the Interact On Trigger 2D component, which will let us accomplish what we aim to do:

The functions are as follows:

Layers

Get Hands-On Game Development without Coding 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.