## Installing the Dialogue System .unitypackage into an Existing Unity Project
A **.unitypackage** is a Unity package file that bundles assets, scripts, prefabs, and more into a single file for easy sharing and installation. Follow these steps to add the Dialogue System to your existing Unity project.
### **Prerequisites**
- Unity Installed: Ensure you have Unity installed (version 2020.3 or later recommended for compatibility).
- Existing Project: Open the Unity project where you want to install the Dialogue System.
- Downloaded .unitypackage: Have the .unitypackage file (e.g., DialogueSystem.unitypackage) saved on your computer from the website.
### **Step-by-Step Instructions**
1. #### **Open Your Unity Project:**
- Launch **Unity Hub**.
- Select your existing project from the list (or create a new one if starting fresh).
- Click **Open** to load the project in the Unity Editor.
2. #### **Import the .unitypackage:**
- In the Unity Editor, go to the top menu: **Assets > Import Package > Custom Package....**
- A file explorer window opens—navigate to where you saved the **DialogueSystem.unitypackage**
- Select the .unitypackage file and click Open.
3. #### **Review the Import Dialog:**
- The **Import Unity Package** window appears, listing all contents (e.g., scripts, prefabs, folders like **Assets/Scripts/Grok.Dialogue**).
- By default, all items are checked—leave them as is unless you want to exclude something (not recommended for first install).
- Click **Import** in the bottom-right corner.
4. #### **Wait for Import:**
- Unity imports the package—progress shows in the bottom-right corner of the Editor.
- Once complete, new folders and assets appear in the **Project** window (e.g., **Assets/Scripts/Grok.Dialogue**, **Assets/Prefabs**, and **Asset/Resources**).
5. #### **Verify Installation:**
- In the **Project** window, check for:
- **Assets/Scripts/Grok.Dialogue** with **DialogueManager.cs**, **NPCConversationManager.cs****,** etc.
- Prefabs like **Canvas-DialogueDisplay**, **DialogueManager**, **Merchant-NPC**.
- If you see these, the package installed successfully!
6. #### **Add Prefabs to Your Scene:**
- In the **Project** window, navigate to **Assets/Prefabs** (or wherever prefabs landed).
- Drag **Canvas-DialogueDisplay**, **DialogueManager**, and **Merchant-NPC** into your Hierarchy window.
- Position them as needed (e.g., ensure Canvas-DialogueDisplay is at (0, 0, 0)).
7. #### **Configure References:**
- Select **DialogueManager** in the Hierarchy.
- In the Inspector, assign UI references from **Canvas-DialogueDisplay** (see “Unity Editor Setup” in the main manual for details).
- Test by pressing Play and hitting **T**—the **Merchant-NPC** prefab’s sample dialogue should trigger if pre-configured.
8. #### **Or, open the Sample Scene**
- Open from **Assets\Scenes** the **GrokDialogue** scene
- Everything is already set up!
### **Troubleshooting**
- **Missing Files****:** If scripts or prefabs don’t appear, re-import the **.unitypackage**—ensure no errors blocked the process (check the Console).
- **Errors on Import****:** If you see script errors (e.g., missing **TMPro**), install the TextMeshPro package via **Window > Package Manager > TextMeshPro > Install**.
- **Hierarchy Issues****:** If prefabs don’t work, ensure they’re not nested—drag fresh instances from the Project window.
### **Next Steps**
- **[[2.Dialogue System User Manual]]**
- Follow the **“Unity Editor Setup”** section in the main manual to configure the Dialogue System fully.
- Explore **[[Creating a Sample Conversation]]** to start building your own dialogues!