Links

Detailed Setup

1. Add the “FPSController_Prefab” from the “Prefabs” folder to your scene. You can drag this into the hierarchy or the main scene. Please navigate to the scripts folder and add the “PLRaycast” script to your “MainCamera”. (If not already from the FPS_Prefab I have provided).
  • Set your "MainCamera" to the tag of "MainCamera"
  • Set the FPSController layer to “Ignore Raycast”
  • NOTE: Make sure these have the "Padlock_Camera_Mechanism" object parented
2. 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 a:
    • “Box Collider”
    • “PLItem” script should already be on the prefab. If not, add it from the “Scripts” folder. Add the “Padlock_Controller” to the empty slot which will be found in this asset stack.
3. Look at the “Padlock_Camera_Mechanism” in front of your camera, make sure this is parented, like the image below. Position the padlock by moving it around in your scene using a half split of game view and scene view to get it into your desired place!
4. Open the “Padlock_Mechanism” object and the children should be named “Padlock_Combination#X” – These should each have a script called “PLCombinationSpinner” attached.
  • Make sure to add the “Padlock_Controller” object to that slot (The next step will be adding the controller and set the Row from the dropdown according to the number of the spinner.
  • Make sure to have a "Box Collider" added
  • Make sure to have a "Rigidbody" added
5. Select the “Padlock_Mechanism” Object that you parented and hide that gameobject by going to the very top left of the inspector and unticking it so it will not be available in the scene until we tell it to be.
6. Select “Padlock_Controller” object if not already added from the combined prefabs to your project, which will have the "PLController" script added
NOTE: Read through the information below and attach the correct GameObjects in the “Padlock_Controller” 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
CameraPadlock
Add the corresponding “Padlock_Mechanism” to this slot.
Audio Names
The ScriptableObjects for all audio effects
Trigger Object
Added your trigger event which would have the script “PadlockTrigger”.
isPadlockTrigger
Only tick this if you’re using a trigger event and have filled the above slot.
Unlock Event
You can add a gameobject with a script you want to activate when you get the code correct.
7. You might want to increment the “Padlock_Interactable” and “Padlock_Mechanism” with a “A1” and “B2” if you have more than one padlock in each scene to make linking up the scripts easier.
  • NOTE: For example: “Padlock_Interactable_A1” and “Padlock_Mechanism_A1” so you know these two assets are to be used together! If you have duplicates then name those other assets to: “Padlock_InteractionB2” and “Padlock_MechanismB2”.
8. 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.