# Trap

![](https://4289778471-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVKw8MgRKSYbFzCqlnm%2F-MW52twd1CBHJ1Wr-ffw%2F-MW52yrB3TICfe0xbU26%2Ftrap%20base.PNG?alt=media\&token=f98d4510-8fec-4be1-a0cd-8cde394fe1fe)

This component organizes the different [mechanisms](https://traps.runemarkstudio.com/traps/trap-mechanism) into a single trap and activates them when it is triggered.

![](https://4289778471-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVKw8MgRKSYbFzCqlnm%2F-MW-lhwhUt9zy4dIOM2X%2F-MW-m8FocT-hllABncHj%2Ftrap-screenshot.PNG?alt=media\&token=b374a76d-8163-443b-83fa-448afd93c259)

* **Start Mode:** Selecting the OnAwake option will automatically activate the trap when the game starts. OnEvent allows you to activate with a TrapTrigger or directly from a script.
* **Sync:** Uncheck this option to set an activation delay for each mechanism.
* **Mechanism:** You can add or remove as many mechanisms as needed.

You can access the following methods and parameters from the code.

```csharp
// Returns if the trap is currently active or not.
bool isActive { get; }    

// Activates the trap if Start Mode is set to OnEvent.
void Activate()     

// Inactivates the trap.
void Deactivate()

// Toggles between active and inactive states. 
// Can only activate if Start Mode is set to OnEvent.            
void Toggle()                
```
