Detailed Setup


Tag Note:

  • Your Safe Model will need a tag of:

    • InteractiveObject (This can be changed in the SafeInteractor script)

Adding Player & Raycast

1). Add an FPSController 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). Make sure your Main Camera has the SafeInteractor on it. (This Raycast script could go on any object but the Main Camera is always easily found.

Make sure your Main Camera has the tag of:

  • MainCamera

Adding UI Manager

2). Now drag the UIManager – Which will include the specific children:

  • EventSystem

  • Crosshair - Canvas

  • InteractPrompt - Canvas

    • UI - InteractPrompt (Make sure this object is turned off at the start)

  • Safe - Canvas (Make sure this entire object is turned off at the start)

Add from the Prefabs folder into the hierarchy. NOTE: Only drag this prefab into the hierarchy, not the scene.

3). Select the UIManager object and look at the SafeUIManager script. You will need to have UI references as below:

Adding Disable Manager

4). Add a DisableManager from the prefabs folder, make sure it has these settings:

  • Player: Add the FPSController

  • Raycast Interactor: Add the Main Camera

Adding Audio Manager

5). Add the AudioManager from the prefabs folder and add all ScripableObject objects from the ScriptableObjects folder. These can be in any order:

Adding Input Manager

6). Add an InputManager from the prefabs folder and choose input references you want to use:

Adding a Safe

7). Place the RaycastSafes or TriggerSafes prefab from the Prefabs folder into your scene. The Raycast Safes should have children of different colours, each colour will be split into their children:

  • Safe_Model - Make sure this object has a:

    • Box Collider

    • SafeItem: Add the safe controller object to this slot

    • Tag: Make sure it has the tag of InteractiveObject

    • Animator Component to control the animation

Setting up Safe Controller

  • Safe Controller: Should have a SafeController script added with the slots needed to be filled below:


Safe Model:

Add your safe model to this slot

Safe Dial

Add the Safe_Dial to this slot

Safe Animation Name:

The default safe door animation is SafeDoorOpen

Before Animation Start:

The timer before the animation starts. Default: 1 second(s)

Before Open Door:

The timer before the door opens. Default: 0.5 second(s)

Safe Solution 1-3:

A number from 0-15 for each of these solutions

Unity Events:

This is a UnityEvent to add custom functionality when it’s opened

Is Trigger Interaction:

Set this to True if you’re using a trigger event

Trigger Object:

Add the trigger event to this slot

Spawning Items & Fixing Interaction Issues

  • If you spawn items inside the safe and you can't interact with them, you can set the layer of the model to ignore raycast. (This is because a raycast won't go through the safe collider and let you interact with items without getting the safe collider to ignore the raycast)

    • Tag: Ignore Raycast

  • You can also add objects you want to spawn by adding the objects to the event and use GameObject.SetActive as an example

Last updated