Detailed Setup
QUICK START: You can add the Entire_Padlock_DemoScene prefab to your scene to get everything setup and ready to go without having to follow any extra steps.
CREATE LAYER: Create a Layer in the top right of the Unity Inspector called PadlockSpinner
Check the Padlock Prefab Spinner Layer:
Open the Padlock Spawnable objects from the prefabs folder and each spinner should be setup as below:
Padlock Spinner Setup:
Make sure to add the PadlockNumberSelector script β Set the row according to itβs row
Box Collider
Rigidbody
Set the Layer to PadlockSpinner (Make sure to create a Layer in the top right of the inspector called PadlockSpinner)
FPSController Setup:
Add the FPSController prefab from the prefabs folder to your scene. (You can drag this into the hierarchy or the main scene.)
Set the FPSControllers layer to Ignore Raycast if you're having interaction issues with player colliders blocking the way
Main Camera Settings:
Add the PadlockInteractor (If not already).
Set the tag to MainCamera
Add a Physics Raycaster
Set the EventMask to PadlockSpinner
Setting Up Trigger or Raycast Versions:
Add PadlockTrigger / Padlock Raycast sets to your hierarchy or scene from the assets Prefabs folder. Add this asset wherever you want in your scene.
Make sure your Padlock_Interactable GameObject has:
Box Collider
PadlockItem script - Add the controller GameObject here (See below)
Padlock Controller Setup:
Select Padlock_Controller object if not already added from the combined prefabs to your project, which will have the PadlockController script added
NOTE: Read through the information below and attach the correct GameObjects in the PadlockController script in the inspector. See the image on the next page for more details
Type | Description |
---|---|
Your Combination | This is the code order you wish to open the padlock. 4 digits (1-9) only. |
InteractableLock | Add the Padlock_Interactable object to this slot |
Prefab To Spawn | This is the prefab from the spawnable prefabs folder that you wish to spawn in front of the camera |
Distance From Camera | How far the padlock should spawn away from your camera |
Animation Name | The animation name to play when opening the lock |
Audio Names | The ScriptableObjects for all audio effects |
isPadlockTrigger | Only tick this if youβre using a trigger event and have filled the above slot. |
Trigger Object | Added your trigger event which would have the script PadlockTrigger |
Unlock Event | You can add a gameobject with a script you want to activate when you get the code correct. |
Adding The Managers:
Make sure to add the managers from the prefabs folder:
DisableManager - Add the Player object and the main camera to these slots to find the appropriate reference
InputManager - These are the inputs for the system, change as required
AudioManager - Add all of the appropriate ScriptableObject audio effects from the scriptableobjects folder
UIManager - This UI manager will have the canvas for all UI elements parented and you should add the correct UI elements to the slots in the manager.
Last updated