# Installing Samples

This sample contains shared assets, prefabs, and configuration data used by the networked examples.\
The Fusion and PUN samples depend on this content to run correctly.

***

### **1. How to Install Samples**

1. Open **Window → Package Manager**.
2. Select **Runtime Spawner** from your list of packages.
3. Switch to the **Samples** tab.
4. Click **Import** beside the samples you want.

<figure><img src="https://627544832-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAjayiCOvbs0xN74JSxBK%2Fuploads%2F3ryGx7DdNee8VoMjN9SZ%2F2025-11-09%2014_14_22-.png?alt=media&#x26;token=2cf43512-eb6a-4698-9de6-9bc8ebfcfdff" alt=""><figcaption></figcaption></figure>

Once imported, Unity creates:

```
Assets/Samples/Runtime Spawner/<version>/
```

Each sample installs to its own subfolder.

***

### **2. Available Samples**

#### **Runtime Spawner Sample (Base)**

**Folder:** `Runtime Spawner Sample/`\
**Size:** \~20 MB

**Purpose:**\
Core single-player example demonstrating the basic Runtime Spawner workflow.

**Includes:**

* Several demo scenes showcasing the various use cases (global, local, wave etc)
* Player and AI prefabs
* Example spawn entries and profiles
* Diagnostics HUD and helper UI
* Example character controller and AI logic

**Use this sample to:**

* Learn how the spawner initializes, populates, and despawns entities.
* Test **NavMesh placement**, **spawn hints**, and **region population** locally.
* Use it as the foundation for your own experiments or integrations.

***

#### **Runtime Spawner Fusion Sample**

**Folder:** `Runtime Spawner Fusion Sample/`\
**Size:** \~210 KB

**Purpose:**\
Shows how to integrate the Runtime Spawner with **Photon Fusion 2.x** networking.

**Prerequisites:**

* **Photon Fusion 2.0** (installed via the Fusion SDK or Asset Store)
* **Runtime Spawner 1.5.0+**
* **Fusion CodeGen** enabled and run at least once

**Includes:**

* `FusionBootstrap` setup script (creates a NetworkRunner)
* `FusionFactoryAsset` and `FusionPoolObjectProvider`
* Example networked player prefab
* Minimal demo UI for starting as host/client

**Use this sample to:**

* Understand how to bridge Fusion’s networking with the Runtime Spawner.
* See how the **host** controls spawning while clients receive replicated objects.
* Study pooling and lifecycle management through Fusion’s IPoolAdapter bridge.

***

#### **Runtime Spawner PUN 2+ Sample**

**Folder:** `Runtime Spawner PUN Sample/`\
**Size:** \~220 KB

**Purpose:**\
Demonstrates integration with **Photon PUN 2 or PUN 2+** networking.

**Prerequisites:**

* **Photon PUN 2 or PUN 2+** (imported from the Asset Store)
* **Runtime Spawner 1.5.0+**
* **Megacrush Object Pool** (installed automatically with Runtime Spawner)

**Includes:**

* `PunBootstrap` component (connects to Photon Cloud, joins/creates room)
* `PUNFactoryAsset` and `PUNPoolPrefabProvider`
* Example networked player prefab with `PhotonView`
* `PUNPrefabKey` helper component for prefab registration

**Use this sample to:**

* Observe how spawning runs only on the **Master Client** while others replicate.
* Learn prefab registration via the provider and use of pooling for performance.
* Extend or replace `PunBootstrap` for your own PUN game flow.

***

### **3. Folder Structure**

All samples share a consistent folder layout:

```
Code/        – Example scripts (controllers, AI, networking)
Content/     – Materials and prototype textures
GameData/    – Example SpawnEntry profiles
Prefabs/     – Player, AI, and environment prefabs
Scenes/      – Sample scenes for each mode
```

You can copy or adapt these assets directly in your own project.

***

### **4. TextMesh Pro Essentials**

When first opening a sample scene, Unity may prompt you to import **TextMesh Pro Essentials**.\
This is required for the demo UI to function.\
Click **Import TMP Essentials** when prompted.

***

### **5. Getting Started**

1. Import the **Runtime Spawner Sample** (base).
2. Then optionally import **Fusion** or **PUN** samples, depending on your project.
3. Open a demo scene (for example, `RuntimeSpawner_Fusion_Demo.unity`).
4. Press **Play** to watch the spawner initialize and populate.
5. (Networking samples) Run a second instance to join as a client and observe replication.

***

### **Next Steps**

* [Fusion Integration Setup Guide](https://megacrush.gitbook.io/megacrush-unity-assets/runtime-spawner/runtime-spawner-user-manual/getting-started/networking-integrations/photon-fusion-integration-guide)
* [PUN 2+ Setup Guide](https://megacrush.gitbook.io/megacrush-unity-assets/runtime-spawner/runtime-spawner-user-manual/getting-started/networking-integrations/photon-pun-2+-integration-guide)
* [Factory System Overview](https://megacrush.gitbook.io/megacrush-unity-assets/runtime-spawner/runtime-spawner-user-manual/technical-details/factory-system-overview)
* [Object Pooling Overview](https://megacrush.gitbook.io/megacrush-unity-assets/runtime-spawner/runtime-spawner-user-manual/technical-details/object-pooling)
