# URP Setup

### Do you need a URP version of the APK?

{% hint style="info" %}
Just send an email to: **<speedtutoruk@gmail.com>** via my [website](https://www.speed-tutor.com/pages/contact) with your **invoice number** and I'll happily send it your way. If not check the URP setup guides to do it all yourself!
{% endhint %}

## Importing Notes & Troubleshooting

### Tag & Layer Setup

{% hint style="info" %}

* Make sure to create tags called:
  * **InteractiveObject**
  * **ExaminePoint:** Tag for the **ExaminePoint** gameobject parented to the **ExamineCamera**
  * **InspectPoint:** Tag for every single inspect point that exists for an object
* Create Layers:&#x20;
  * User Layer 8: **ExamineLayer** (Doesn't need to be added to objects, referenced in code)
  * User Layer 9: **InspectPointLayer** (Tag for every single inspect point)
  * User Layer 10: **PostProcess**
  * User Layer 11: **PadlockSpinner**
    {% endhint %}

{% hint style="warning" %}
**LAYER NOTE:** If you can place these on the corresponding User Layers (As below) it is easier for setup, as Unity will automatically place them in the correct places so the below information might not be all relevant to you. (It's worth checking through just in case)

* IF NOT added to these layers check the sections below on **Checking Prefabs (See side bar)** - Just to confirm all appropriate layers are added and no issues arise.
  {% endhint %}

### TextMeshPro Required

{% hint style="info" %}

* Please note that TMP will appear as a popup if not installed in your project
* Click **Import TMP Essentials** to use the system fully
  {% endhint %}

### DontDestroyOnLoad yellow warning

{% hint style="warning" %}
This just means that objects that use **DontDestroyOnLoad** shouldn't be children of a parent. Just make sure they exist in your hierarchy without a parent, when you choose to finalise your product. I just kept them in little organised areas for the sake of visuals.&#x20;
{% endhint %}

<figure><img src="/files/c1RcZFoyZZvmprr6pCEs" alt=""><figcaption></figcaption></figure>

### Other Issues? Contact Me!

{% content-ref url="/pages/Yb25K5PcHe5zTDcsLjzg" %}
[Contact Me](/apk-doc-v1.7/contact-me/contact-me.md)
{% endcontent-ref %}

## (Please Read) Important Import Suggestions

{% hint style="info" %}
Download and import the Adventure Puzzle Kit from the package manager.&#x20;

* Window > Package Manager > Search for "Adventure Puzzle Kit"
  {% endhint %}

{% hint style="danger" %}
**Importing Tips:**

1. Import into a fresh project rather than a working project (To avoid issues or conflicts)
2. Always keep a backup of your working project **BEFORE** importing **ANY** assets
3. In the **Import Unity Package** dialog box that appears when you first click to import the asset (It will show all the folder structure in a last)
   1. Choose the first **Next** button which will lead to the **Project Settings**
   2. **UNTICK** the project settings folder (None of the items will be ticked at this point)
   3. Select the Import button to start the new import
      {% endhint %}

### Step 1 - Errors & FIxes On Import (URP)

You will get import errors that refer to **Post Processing** - We'll fix those below:

{% hint style="info" %}

1. Open the **AKUIManager** (Adventure Puzzle Kit > Scripts > Core > AKUIManager)
   1. Change the top line from:
      {% endhint %}

```csharp
//FROM THIS
using UnityEngine.Rendering.PostProcessing;

//TO THIS
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
```

{% hint style="info" %}
2\. In the **AKUIManager --** Find the **GasMask Fields** section (It will be a foldout group for all variables towards the top of the script)

1. Towards the bottom of that fold out you will see: **Post Processing Effects** header and fields related and replace them with:&#x20;
   {% endhint %}

```csharp
//OLD REFERENCES
[SerializeField] private PostProcessVolume _postProcessingVolume = null;
[SerializeField] private PostProcessProfile _originalProfile = null;
[SerializeField] private PostProcessProfile _gasMaskProfile = null;
private Vignette _vignette;
private DepthOfField _dof;

//CHANGE TO THIS
[SerializeField] private Volume _postProcessingVolume = null;
[SerializeField] private VolumeProfile _originalProfile = null;
[SerializeField] private VolumeProfile _gasMaskProfile = null;
private Vignette _vignette;
private DepthOfField _dof;
```

{% hint style="info" %}
3\. In the **AKUIManager --** Inside the **Awake()** method you will see these lines (Inside the Gas Mask Getting PP Settings foldout)
{% endhint %}

```csharp
//OLD REFERENCES
_gasMaskProfile.TryGetSettings(out _vignette);
_gasMaskProfile.TryGetSettings(out _dof);

//CHANGE TO THIS
_gasMaskProfile.TryGet(out _vignette);
_gasMaskProfile.TryGet(out _dof);
```

### Step 2 - APK Startup Window

{% hint style="info" %}
The APK startup window should appear, you may need to expand the window to see all the button links (If they aren't visible).&#x20;

* You can dock this window if you wish and has FAQ information, contact buttons and helpful information.
  {% endhint %}

{% hint style="success" %}
Open APK help window for easy links and advice: **APK** > **Tools** > **Adventure Kit Support Hub**&#x20;
{% endhint %}

### Step 3 - Open the Demo Scene

We'll open the demo scene so we can get the basics setup to be used, follow steps below

{% hint style="info" %}

1. Navigate to Assets > Adventure Puzzle Kit > Scenes > FirstPerson\_AdventureKit\_Demo
2. Double click to open this scene to start using it
   {% endhint %}

### Step 4- Upgrading Materials

EVERYTHING IS PINK?!??!! All materials will need updating so please navigate to:&#x20;

{% hint style="info" %}

1. **Window > Rendering > Render Pipeline Converter** and then select:&#x20;
   1. Choose: **Built-in to URP** from the dropdown
   2. Click the **Material Upgrade** checkbox
   3. Then press: **Initialize Converters**
   4. Then select: **Convert Assets**

All materials will be re-build for URP (Some custom materials may not have done so as they were Built-in specific)
{% endhint %}

### Step 5 - Creating Tags & Layers

Select any GameObject in the Hierarchy and then create tags and layers in the top right of the inspector (Some or all tags may already be created)

{% hint style="info" %}

* Make sure to create tags called:
  * **InteractiveObject**
  * **ExaminePoint:** Tag for the **ExaminePoint** gameobject parented to the **ExamineCamera**
  * **InspectPoint:** Tag for every single inspect point that exists for an object
* Create Layers:&#x20;
  * User Layer 8: **ExamineLayer** (Doesn't need to be added to objects, referenced in code)
  * User Layer 9: **InspectPointLayer** (Tag for every single inspect point)
  * User Layer 10: **PostProcess**
  * User Layer 11: **PadlockSpinner**
    {% endhint %}

{% hint style="warning" %}
**LAYER NOTE:** If you can place these on the corresponding User Layers (As below) it is easier for setup, as Unity will automatically place them in the correct places so the below information might not be all relevant to you. (It's worth checking through just in case)

* IF NOT added to these layers check the sections below on **Checking Prefabs (See side bar)** - Just to confirm all appropriate layers are added and no issues arise.
  {% endhint %}

### Step 6 - Creating New Post Processing

We'll be creating a new Post Processing volume for URP so we can use it in the system

{% hint style="info" %}

1. Find the **Post Processing Volume** GameObject (This can be an empty GameObject, so don't worry too much)
2. Set the layer of this GameObject to **PostProcess** (if not already)
3. Remove the associated script that is missing by clicking the 3 dots and choose **Remove Component**
4. Choose **Add Component**&#x20;
   1. Add a **Volume** component (Specific to URP)
5. Create a new post processing volume by clicking **NEW**
   1. Call this **GasMaskURP\_PP\_Profile** (Or something that you will remember)
      1. Add **Vignette**: Set the **intensity** to: **0.485**
      2. Add **Depth of Field**:&#x20;
         1. Set the **Mode** to **Bokeh**
         2. Set **Focus Distance** to **0.1**
         3. Then disable these effects by the main check boxes (These checkboxes are next the names of the effect)
            {% endhint %}

<figure><img src="/files/RKYUaz1F1nPkfDjpgs1F" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
6\. Then you can duplicate the **GasMaskURP\_PP\_Profile** or create a new profile called **Original\_PP\_Profile** (This is so we can switch between them, and use all of your own effects relevant to your game)
7\. Open the **AK - UIManager** object

1. Open the **Gas Mask Properties** (By selecting the checkbox next to the Gas Mask Properites)
   1. Add the **Volume** (Most likely your GameObject called **Post Processing Volume**) to the **Post Processing Volume** slot&#x20;
   2. Add the two profiles you just created to these slots for the Gas Mask and Original Profile (You can click the little find box next to each, to find corresponding GameObjects you could use)
      {% endhint %}

### Step 7 - Editing The Disable Manager

We need to edit the disable manager to make sure we disable any blurs when we don't need them either when examining or otherwise

{% hint style="info" %}

1. Open the **AKDisableManager** script (Inside the Assets > Adventure Puzzle Kit > Scripts > Core)
   1. Add the two namespaces to the top of the script:
      {% endhint %}

```csharp
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
```

{% hint style="info" %}
2\. Add these fields under the rest of the fields in this script:
{% endhint %}

```csharp
[Header("Post Processing")]
[SerializeField] private Volume _postProcessingVolume = null;
private DepthOfField _dof;
```

{% hint style="info" %}
3\. Add this to the **Awake()** method:
{% endhint %}

```csharp
_postProcessingVolume.profile.TryGet(out _dof);
```

{% hint style="info" %}
4\. In the **SetCameraAndPlayerState** method you can add this anywhere in the script:&#x20;
{% endhint %}

```csharp
if (_dof != null)
{
    _dof.active = disable && isExamine;
    _dof.focusDistance.value = (disable && isExamine) ? 0.1f : 10f;
}
```

{% hint style="info" %}
5\. Make sure to add the **Post Processing Volume** GameObject to the **AKDisableManager** in the inspector
{% endhint %}

<figure><img src="/files/qFO51SjIoBsZsP6r4NVY" alt=""><figcaption></figcaption></figure>

### Step 8 - Setting Up Main Camera

We need to make sure we setup camera stacking for additional examination rendering and appropriate layers for culling objects away, for best optimisation

{% hint style="info" %}

1. Select your **Main Camera** usually a child of the **FPSController** (APK - FPS Controller > FPS Controller > Main Camera)
2. Look at the **Culling Mask** under the rendering section and **UNTICK**
   1. **ExamineLayer**
   2. **InspectPointLayer**
   3. **PostProcess**
3. In Rendering section of the Main Camera
   1. **TICK** the **Post Processing** checkbox
4. In the Environment section  > Volumes > Volume Mask
   1. Set the Volume Mask to have **PostProcess** ticked and everything else **UNTICKED**
5. Make sure the camera has a **Physics Raycaster** script component attached (If not add the component)
   1. Set the **Event Mask** to **PadlockSpinner**
   2. Leave Max Rays to 0
      {% endhint %}

### Step 9 - Examine Camera & Stacking

We'll Look at the examine camera now, to make sure we have everything setup for examining with this camera

{% hint style="info" %}

1. Select the **Examine Camera** (This is a child of the Main Camera)
   1. Make **Culling Mask** has the **ExamineLayer** & **InspectPointLayer TICKED ONLY!**
2. Select the **Examine Camera** — Select the Render Type drop down (At the top of the camera)
   1. Make sure it’s type is **Overlay Camera** and **NOT** Base. (Only one camera, your main camera should be set to **Base**)
   2. You should now see the demo scene without the white screen — Wooohooo!
3. On the **Main Camera** find the **Stack** option section
   1. &#x20;Click the **+** icon and now add the E**xamineCamera** to this slot
      {% endhint %}

### Step 10 - Using Deferred Rendering?

Deferred rendering doesn't allow camera stacking so we need a little work around for this, I have details on this too

{% hint style="info" %}
Look at the [Deferred Rendering section](/apk-doc-v1.7/urp-deferred-rendering.md) on the left bar if you're having issues whilst using a deferred setup
{% endhint %}

### Step 11 - Checking Prefabs

We just need to check we have the correct layers on the padlock spinners or they won't be detected properly

{% hint style="info" %}

1. Go into the **Prefabs** > **Spawnable** > **Padlock** folder
   1. Open the brass and black padlocks seperately (By double clicking the prefabs)&#x20;
   2. Select all of the **combination spinners** and make sure the all have the layer of **PadlockSpinner** (In the top right of the inspector when you select the spinners)
      {% endhint %}

### Step 12 - Check Examination Objects&#x20;

We just need to check examine objects have the correct layers on their inspect points (So they render correctly)

{% hint style="info" %}

1. Inside the Puzzle Objects GameObject folder in the Hierarchy&#x20;
2. Open the **Examine - Objects**
   1. Find any object which has I**nspect Points** (The knife will have some by default)
   2. Make sure these inspect points have a layer of **InspectPointLayer** (Or they will not render correctly)
3. You can check any other object which has inspect points but should be setup by default!
   {% endhint %}

<figure><img src="/files/822wm49vZPgEFkvMZvSC" alt=""><figcaption></figcaption></figure>

### Step 13 - Add the Entire Scene Prefab

{% hint style="info" %}
Drag into your scene the **APK - Demo Scene - Prefab** (Adventure Puzzle Kit > Prefabs > Demo Scene Prefab)
{% endhint %}

### Step 14 - Enable Legacy Input System (If required)

We'll need to enable the legacy system if you're using Unity 6+ and it isn't enabled by default

**NOTE: New input system support is coming in v1.8**

{% hint style="info" %}

1. Go to **Edit > Project Settings > Player > Other Settings**
2. Scroll down half way and you'll see **Active Input Handling**
3. Set this dropdown to **BOTH** and press **Apply (**&#x54;he editor will restart)
   {% endhint %}

### Others Issues? Contact Me!

{% content-ref url="/pages/Yb25K5PcHe5zTDcsLjzg" %}
[Contact Me](/apk-doc-v1.7/contact-me/contact-me.md)
{% endcontent-ref %}


---

# 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://speedtutoruk.gitbook.io/apk-doc-v1.7/getting-started/urp-setup.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.
