# Object Poolers

RSB uses object poolers to handle spawning/instantiating prefabs that will be used during simulation. These prefabs can be bullet tracers, in-game trajectory renderers, hit particles etc. In order to safely handle object instantiation in an optimized manner, RSB makes use of **Object Poolers.**  Create a new empty game object in your scene and name it **Tracer Pooler.** We will later on use this object to pool **tracers**, visualized objects simulating bullet tracers. Add the component **ObjectPooler.cs** on it.

![ObjectPooler.cs settings.](https://lh3.googleusercontent.com/QALew9wrvrQvzitvpUBlzHY65LVIlMveQ0c-7--tK0bmFnAbhioAgjU-Nio45RUpYDImKIAJFpogplpVBdnFv9a-qkxliBlyDiJQo9DQc8X_KXkpqkzfoP-0m15pebHr_J953sn4)

You need to assign the **Pooled Object** field as a prefab in your project folders. Navigate to **InanEvin>Realistic Sniper And Ballistics>Objects>BulletTracer** folder and drag & drop the tracer prefab into the slot. You can leave the other settings as default. What this will do is that when you start your scene, this script will instantiate **Pooled Amount** of bullet tracers in awake, disable them all and keep them in a list. Later on, our system will request a new tracer object whenever it is needed, and this script will return an available one from the list, without instantiating. This way, we delegate the instantiation of prefabs to the **Awake(),** saving us the runtime performance drop of instantiating. The same approach will be used on any other type of instantiation, for in-game trajectory renderers, hit effects, muzzle flashes etc.


---

# 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://rsb.inanevin.com/getting-started/object-poolers.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.
