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 |