Detailed Setup

NOTE: You can get a quick start using the Entire_Keycard_DemoScene object and drag that straight into your scene. This will everyone to be already setup, you can delete the art assets as required but checkout the demo scene if you’re confused!

Player:

  • Layer of: Ignore Raycast

Any Interactable Object:

  • Tag InteractiveObject or as per the raycast script on the main camera, it will have the tag you need!

Setting Up The Raycast

  • Add an FPSController prefab to your scene. (Unless you’re using the demo which will already have one added but the package will be required to be imported before use).

  • You can add the KCInteractor script to either the main camera or the main player object.

Adding the Managers

  • Now drag the (from the Prefabs folder into the hierarchy)

    • KCInputManager

    • KCUIManager

    • KCAudioManager

    • KCInventoryManager

NOTE: Only drag this prefab into the hierarchy, not the scene.

UI Manager Setup

  • Select the UIManager, which will have the KCUIManager script and make sure all the items are connected as below:

All UI objects will be below this parent in the canvas

  • Make sure to add the slots, crosshair and inventory canvas like is under the UIManager object

Inventory Canvas Setup

  • The Keycard Inventory Canvas is under the UI Manager

The system uses a CanvasGroup on the main Canvas object which controls how to show and display the UI. It will fade the canvas in and out.

Setting up the inventory

  • Select the KCInventory – This item shouldn’t need editing at all, just make sure it’s on an empty gameobject

We don't need to do anything with this script, it will be updated automatically!

Setting up the Input Manager

  • Select the KCInputManager and make sure you choose button commands that you wish, from the dropdowns

Setting up the Audio Manager

  • Select the AudioManager and add the ScriptableObjects for sounds you will have created. (The ScriptableObjects folder will have some examples)

Adding Audioclips

Creating a Keycard Pickup

You can add a keycard from the prefabs folder, all of the details should already be setup but check the details below to make sure.

  • Tag: InteractiveObject

  • Add a Box Collider

  • Add a KCItem script to the object and set the ItemType to Keycard

  • Add a KCKeyCollectable script and add the appropriate ScriptableObjects and your desired ScriptableObjects audio clip. (Found in the ScriptableObjects folder)

Creating a Scanner with Event

You can add a keycard scanner from the prefabs folder, all of the details should already be setup but check the details below to make sure.

  • Tag: InteractiveObject

  • Make sure to add a Box Collider

  • Add a TKItem script to the object and set the ItemType to Scanner

  • Add a TKScannerInteractable script and add the appropriate ScriptableObjects and settings:

Remove Key After Use

Should the key be removed from the inventory after using it with the scanner?

Key Scriptable

Add the key scriptable object that is specific for this scanner

Sounds

Add the sound SO's that are in the screenshot below

Unlock Event

The event which happens when the key is inspired, so in my demo this plays the animation from the KCDoorOpen script which is on the prefab object.

Last updated