Lever Puzzle Sys - Setup

Basic Steps

  1. I'd recommend adding the "LeverSystem_Objects" from the "Prefabs > Individual_Prefabs > Single Objects" section this should include a:

    1. "SwitchBox_Model" object (With Interaction_Colliders)

    2. "LeverController_1" (With power levers)

  2. "LeverController_1" should have a:

    1. "LeverSystemController" script attached

    2. Tag of "LeverController"

  3. Inside the "LeverController_1" object should be the power levers - They should have:

    1. Tag of "InteractiveObject"

    2. Layer of "Interact"

    3. Box Collider attached

    4. AKItemController script - Primary set to "Lever Sys"

    5. LeverItemController script - Set to "Lever"

    6. LeverController script

      1. Set the number to the number you want this lever to be in the sequence

      2. Set the animation name, the default is "Handle_Pull"

      3. Add the "LeverController_1" object to this slot

  4. The SwitchBoxModel > InteractionColliders

    1. TestButtonCollider & ResetButtonCollider should have:

      1. Tag "InteractiveObject"

      2. Layer "Interact"

      3. Add a "Box Collider"

      4. AKItemController set to "Lever Sys"

      5. LeverItemController set to "Test Button" and "Reset Button" respectively

      6. LeverController script with just the "LeverController_1" object adding to the bottom slot

  5. If you're using more than one instance of this puzzle in the same scene, duplicate the entire "LeverSystem_Objects" folder to make a clone

Lever System Objects Setup

  • I have created a basic setup for organising the system, an empty gameobject to hold all of the lever assets:

    • LeverController

    • SwitchBox_Model

Lever Controller Setup

This object should be an empty GameObject and it will control everything that goes on for your lever system!

Make sure this object has a "LeverSystemController" script attached

In-game order (Used for debugging ONLY):

Custom Order:

Pull Limit:

Timer before being allowed to pull the next lever:

Add all of the required objects to the array:

Control Box Switches:

Control Unit Lights:

Accept / Reset Buttons:

Switch Object - Animation Names:

Audio Sounds:

Unlock Events:

You can use the "+" icon to add an event for when you get the correct code, you can add custom interactions if you create a new script with a public method to spawn objects, or some other type of interaction when the combination for the levers is complete.

Power Lever Setup

Add this script to a 3D Keypad model from the prefabs or one you may have created yourself

  • Make sure your object has a tag of "InteractiveObject"

  • Layer of "Interact"

  • Add a "Box Collider" to your object

  • Add an "AKItemController" - Set the System Type to: "Lever Sys"

  • Add a "LeverItemController" script to the object - Set to "Lever"

  • Add a "LeverController" script

    • Set the number of the lever in the script for your order

    • Add the name of your animation for the lever pulling (Default is "Handle_Pull")

    • In the "LeverSystemController" slot - Add the "LeverController_1" to this slot

Test & Reset Buttons

Do the same as above but set the "ObjectType" in the "LeverItemController" script to either "Test Button" or "Reset Button" depending on the button you want to add!

Default Controls

  • Left Click to interact with the levers or switches

    • You can change these in the "InputManager"

Last updated