# Add selection to scene

Here you can follow few short steps to add selection to your scene.  You can choose from predefined selection areas or implemented your own.

{% tabs %}
{% tab title="Video" %} <img src="https://425343605-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fml7vS0D5xN2Q8jQMEmBv%2Fuploads%2F9zGUokhfI2gdPjK3umfI%2FUnit%20Selector%20Setup%20resized.gif?alt=media&#x26;token=382843b0-9c24-4204-a32e-76d520e15cb0" alt="" data-size="original">
{% endtab %}

{% tab title="Steps" %}
**Steps to set up:**

1. You can start by creating an empty Game Object and attach `UnitSelector` component to it or by dragging the <mark style="color:green;">**SelectionSystem**</mark> prefab into your scene, which is partially already configured for use. See **Main tab** and set up the following:

   * Once Selection is in the scene, set the camera to your player's camera (`Camera.main` will be used if it's not set)
   * Check out configuration options and adjust them for your project respectively
   * Set maximal selection number, if required.
   * Enable or disable quick access for units (saving and loading selection)

2. Next click on **Selection Area** tab and choose from one of the two provided selection area's or reference your custom one. For more details about them and their detection types see here [selection-area](https://travljen.gitbook.io/unit-selection/how-it-works/selection-area "mention").

   * **1st option: Selection Screen Rectangle** for 2D screen space selection area.
   * **2nd option: Selection World Cube** for 3D world space selection area.&#x20;

     Here you have to set the **Ground Layer Mask** because the world selection needs ground position to start somewhere.

3. Now you can set up player interactions with the input on **Input tab**. Here you have support for:
   * **None:** requires manual management of selection active states, either directly on `UnitSelector` or by implementing your own `AInputControl`
   * **Legacy Input**: uses built-in Unity input system
   * **New InputSystem**: utilises Unity latest and flexible input system (Package manager dependency)

4. Finally you can update any UI or notify your own components of selection events in the **Events tab**.

5. Save Scene.
   {% endtab %}
   {% endtabs %}

In case your camera is spawned later or loaded with a different scene, you can always use set it up later once you have the reference to it. Like this:

```csharp
// Set camera in code at any time
FindObjectOfType<UnitSelector>().SetCamera(Camera.main);
```

Ok, You are now **done** with scene set up.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://travljen.gitbook.io/unit-selection/getting-started/add-selection-to-scene.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
