Example

Puzzle System

Two puzzle components, two puzzle types. PuzzleSwitchChecker fires when all switches reach their required states — order doesn't matter. PuzzleSequenceChecker fires when switches are activated in the exact right order.

Combination lock (any order)
Sequence puzzle (order matters)
Opens a door on solve
Resets on mistake

Choosing the right checker

PuzzleSwitchChecker vs PuzzleSequenceChecker

Both use PuzzleSwitch objects as inputs. The difference is what they check.

PuzzleSwitchChecker
All switches must reach their required states
ChecksEach switch is assigned a required state (0, 1, 2…). Solver fires when all match simultaneously.
OrderDoesn't matter. Player can flip switches in any order.
Can unsolvedIf a switch is moved away from its required state, puzzle un-solves and fires onPuzzleUnsolved.
Use forCombination locks, multi-lever doors, "hit all targets" challenges.
PuzzleSequenceChecker
Switches must be activated in exact order
ChecksTracks activation sequence. Fires when switches are triggered in the exact order defined in the array.
OrderMatters. Wrong switch resets progress to step 0 (if Reset on Mistake is on).
Same switch twiceSupported — add the same switch in multiple positions in the array.
Use forMusical puzzles, Simon-says, ritual sequences, ordered button presses.

Type 1

Combination lock — any order

Three switches, each must be in the right state. Wire PuzzleSwitchChecker to open a door when they all match.

  1. 1
    Create switch objects and add PuzzleSwitch
    Create 3 GameObjects. Add PuzzleSwitch to each. Give each a unique Switch ID (e.g. Switch1, Switch2, Switch3). Set Number of States to 2 for simple on/off switches. Wire your interaction input → PuzzleSwitch.Activate() on each.
  2. 2
    Add PuzzleSwitchChecker and assign switches
    Create another empty GameObject and add PuzzleSwitchChecker. In the Switch Targets list, add one entry per switch. For each entry: drag in the switch object, set Required State (0 = off, 1 = on). Leave Automatic Checking enabled — it watches for changes without needing an extra wire.
  3. 3
    Wire onPuzzleSolved to your reward
    Wire PuzzleSwitchChecker.onPuzzleSolvedActionAnimateTransform.Play() to open a door, or GameStateManager.Victory() for a win state. Use onFirstTimeSolved instead if the reward should only happen once even if the player solves it multiple times.

How the checker sees it at runtime

Switch A ✓
Switch1
State 1 — required: 1
Switch B ✓
Switch2
State 1 — required: 1
Switch C ✗
Switch3
State 0 — required: 1

2/3 correct — puzzle not yet solved. When Switch C reaches state 1, onPuzzleSolved fires.


Type 2

Sequence puzzle — order matters

Same PuzzleSwitch objects, different checker. The player must activate them in the order you define. A wrong activation resets progress.

  1. 1
    Set up switches identically to combination lock
    PuzzleSwitch setup is the same — each switch just needs Activate() wired to its interaction input. The sequence checker listens to onActivated internally, so you don't need to wire anything on the switches themselves.
  2. 2
    Add PuzzleSequenceChecker and define the sequence
    Add PuzzleSequenceChecker to a manager object. In the Correct Sequence array, drag in the switches in the order the player must activate them. You can add the same switch more than once — e.g. A, B, A, C is a valid 4-step sequence.
  3. 3
    Configure Reset on Mistake and wire events
    Enable Reset on Mistake if a wrong step should restart from step 1 (recommended for most puzzles). Wire onSequenceSolved to the reward. Wire onMistakeActionPlaySound.PlaySound() for an error sound. Wire onProgressActionDisplayText.Show() to show "Step 2 of 4".
💡
Giving the player feedback is important
The sequence checker has rich progress events. Use onProgress to show a step counter. Use onMistake to play an error sound or flash the screen. Without feedback, sequence puzzles feel broken to players who don't know if they're making progress.

Event Reference

Every event, what it fires on

PuzzleSwitchChecker events

onPuzzleSolvedAll switches are in their required states simultaneously
onFirstTimeSolvedSame as above, but only fires the very first time
onPuzzleUnsolvedA switch moved away from its required state (only if Can Be Unsolved is on)
onProgressChanged(int, int)Correct count changed — passes (correctCount, totalCount)
onSwitchBecameCorrect(int)A switch just reached its required state — passes switch index
onSwitchBecameIncorrect(int)A switch just left its required state — passes switch index
onCheckFailedCheckPuzzle() was called manually but puzzle is not solved

PuzzleSequenceChecker events

onSequenceSolvedSequence completed in correct order
onFirstTimeSolvedSame as above, first time only
onProgress(int, int)Correct step activated — passes (currentStep, totalSteps)
onMistake(int)Wrong switch activated — passes expected step index
onResetSequence reset to step 0 (from mistake or manual ResetSequence call)

PuzzleSwitch events

onStateChanged(int)State changed — passes the new state index
onActivatedSwitch was activated (any interaction)
onState0 … onState4Per-state events — fire only when transitioning to that specific state