> For the complete documentation index, see [llms.txt](https://speedtutoruk.gitbook.io/flashlight-system-doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://speedtutoruk.gitbook.io/flashlight-system-doc/getting-started/main-setup.md).

# Detailed Setup

## Quick Tips & Troubleshooting

{% hint style="info" %}
You can add the **Flashlight - Demo Scene Prefab** to your project and it will have everything setup for you to get going straight away
{% endhint %}

### FPS Controller usage

{% hint style="info" %}
When starting your new project you'll need to use a character controller you wish - I have included my **STFPSController** for ease of use
{% endhint %}

## System Setup

### Step 1 - Player Setup

{% hint style="info" %}

1. Add an **PlayerControllerParent** to your scene (From the prefabs folder).&#x20;
   1. (Unless you’re using the demo which will already have one added)
2. Make sure the **FlashlightSwing** empty gameobject to be attached to a empty parent.&#x20;
   {% endhint %}

{% hint style="warning" %}
Make sure the **FlashlightSwing** is parented to the **PlayerControllerParent** and **NOT** the **FPSController**
{% endhint %}

<figure><img src="https://2090280634-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MX39Smzc-k7JGmVh-dd%2Fuploads%2F9I7MRsb6MMl1Q4o92wVf%2FFlashlightSwing.JPG?alt=media&amp;token=6b249123-16ef-4b0e-a25c-93d11226cc35" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
3\. On the **FPSController -** Make sure you have the layer of **Ignore Raycast (**&#x49;f you have troubles with the raycast not registering when you look towards the ground)
4\. Make sure there is a **FlashlightInteractor** script on the **Main Camera** (This script could go on any object you wish
{% endhint %}

### Step 2 - Flashlight UI Manager Setup

{% hint style="info" %}

1. Add a **FLUIManager** object from the prefabs or add your own via the scripts folder
2. On the **FLUIManager** object make sure to attach all UI elements as per all the children underneath that object, refer to the screenshot below
   {% endhint %}

<figure><img src="https://2090280634-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MX39Smzc-k7JGmVh-dd%2Fuploads%2FQM2C0v9YdLJpn3U3Z25p%2FFlashlightManagerUIElements.JPG?alt=media&amp;token=fc39bd10-e412-4bea-9d4d-a9bfe2ea92c0" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**NOTE:** Only drag the **FLUIManager** prefab into the hierarchy, not the scene
{% endhint %}

<figure><img src="https://2090280634-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MX39Smzc-k7JGmVh-dd%2Fuploads%2FvodJBFD8VGT9J2YskIaM%2FFlashlightUIManager.JPG?alt=media&amp;token=5210a616-25b2-445b-819c-91bc911457e1" alt=""><figcaption></figcaption></figure>

### Step 3 - Audio Manager Setup

{% hint style="info" %}

1. Add an Audio Manager prefab or script to your scene from the prefabs or the scripts folder
2. Refer to page below for more details on adding new audio clips
   {% endhint %}

{% content-ref url="/pages/nYhtZUhwnw0J2hdEu2Cx" %}
[Adding Audio Clips](/flashlight-system-doc/support/adding-audio-clips.md)
{% endcontent-ref %}

<figure><img src="https://2090280634-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MX39Smzc-k7JGmVh-dd%2Fuploads%2F9DnRVLdE8CI209oohAQV%2FAudioManager.JPG?alt=media&amp;token=d6a0ba77-64bb-4034-a007-a0292183a375" alt=""><figcaption></figcaption></figure>

### Step 4 - Flashlight Controller Setup

{% hint style="info" %}

1. Add a **FlashlightController**
2. Look at the **FlashlightController** object and look at the script and set references accordingly, and use values for your game.
   {% endhint %}

<figure><img src="https://2090280634-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MX39Smzc-k7JGmVh-dd%2Fuploads%2FcKJfR6i0AprzFlNkpgWf%2FFlashlightController.JPG?alt=media&amp;token=2295b01a-75f2-4fa7-a65c-c0850394b655" alt=""><figcaption></figcaption></figure>

<table data-header-hidden><thead><tr><th width="374">Variable Name</th><th>Description</th></tr></thead><tbody><tr><td><strong>Variable Name</strong></td><td><strong>Description</strong></td></tr><tr><td>hasFlashlight</td><td>You can choose whether you have a flashlight at the beginning at start or not</td></tr><tr><td>Show Flashlight Inventory</td><td>If this is true, you can press the inventory key to open the flashlight UI</td></tr><tr><td>Infinite Flashlight</td><td>Tick this if you don't want to pickup batteries</td></tr><tr><td>Battery Drain Amount</td><td>Set to 0.01 for slow rate, higher values for faster burn rate</td></tr><tr><td>Battery Count</td><td>How many batteries you have at the start </td></tr><tr><td>Drain Battery Without Dimming</td><td>This means your battery level will decrease but the intensity of the flashlight will never change</td></tr><tr><td>Replace Battery Timer</td><td>The time it takes to hold a key to replace your current battery</td></tr><tr><td>MaxFlashlightIntensity</td><td>The maximum Intensity of the light source</td></tr><tr><td>FlashlightRotationSpeed</td><td>The speed the flashlight will follow the camera</td></tr><tr><td>Flashlight Inputs</td><td>The generic inptus for the system</td></tr><tr><td>Flashlight Spot</td><td>Add <strong>FlashlightSpotlight</strong> gameobject from the <strong>FlashlightSwing</strong> gameobject</td></tr><tr><td>FlashlightMovement</td><td>Add <strong>FlashlightSpotlight</strong> to the slot</td></tr><tr><td>AudioClip ScriptableObjects</td><td>Add the ScriptableObjects from the SO folder to the appropriate slots</td></tr></tbody></table>

### Step 5 - Interactables & Pickups Setup

{% hint style="info" %}

1. Place a **Battery or Flashlight Object** into your scene from the prefabs folder
   1. Add the **FlashlightItem** script to it, if not already attached and select the object type.
   2. Add the number of batteries you will gain from picking up this object.
   3. Make sure this object has a box collider
      {% endhint %}

{% hint style="info" %}
NOTE: You can duplicate these later if you need as many batteries as you require
{% endhint %}
