# How To Spawn Objects

### Mesh collider tip

{% hint style="warning" %}
Make sure the drawer has a mesh collider because you don't want a larger collider (Like a box or sphere collider) blocking the interaction.&#x20;
{% endhint %}

### How to spawn objects

{% hint style="info" %}

1. Go to the **DoorInteractable** script and tick the **Spawn Items** checkbox at the bottom (This will open the additional parameter for items you can spawn)
   {% endhint %}

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

{% hint style="info" %}
2\. Create an empty GameObject which will act as your spawn point for the item (This can be inside your drawer
{% endhint %}

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

{% hint style="info" %}
3\. Add the **ItemSpawner** script to this empty gameobject spawn point
4\. Add the item prefab you want to spawn in the appropriate array
5\. Add the spawn point gameobject to itself as this will be the transform. (I use the additional variable in case you want to spawn via another location)
{% endhint %}

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

{% hint style="info" %}
6\. Go back to your **DoorInteractable** object and add the empty gameobject spawn point to the **OnDrawerOpen()** event box, then select the **ItemSpawner > SpawnItems** from the dropdown box
{% endhint %}

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

{% hint style="warning" %}
You can add additional items to spawn by clicking the **+** icon if you wish
{% endhint %}


---

# 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/door-interaction-kit-doc/getting-started/how-to-spawn-objects.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.
