|
1 | | -# UI-Tutorial-Mask-System-Unity |
2 | | -A simple guided UI onboarding tutorial system for Unity that allows for flexibility and is well optimized for performace |
| 1 | +# 🎮 Unity UI Tutorial System |
| 2 | + |
| 3 | +A **fully customizable, dynamic UI tutorial system** for Unity that helps guide players by highlighting buttons, displaying tooltips, and managing tutorial sequences. This system is designed to be **modular**, **scalable**, and **easy to integrate** into any game project. |
| 4 | + |
| 5 | +## ✨ Features |
| 6 | +- **Dynamic Tutorial Sequences** – Easily create and manage multiple tutorial sequences. |
| 7 | +- **Auto-Generated Enums** – Automatically generate `ButtonID` and `SequenceID` enums from ScriptableObjects. |
| 8 | +- **Button Highlighting** – Focuses on buttons and makes them stand out during tutorials. |
| 9 | +- **Customizable Tooltips** – Position tooltips near buttons dynamically. |
| 10 | +- **Event-Based System** – Hooks into Unity UI buttons with event-driven interactions. |
| 11 | +- **Editor Integration** – Simple tools to manage tutorials from the Unity Editor. |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +## 📥 Installation & Setup |
| 16 | +### 1️⃣ Clone the Repository |
| 17 | +```bash |
| 18 | +git clone https://github.com/BlackSentryDevXo/UI-Obboarding-Tutorial-Mask-System-Unity.git |
| 19 | +``` |
| 20 | + |
| 21 | +### 2️⃣ Import into Unity |
| 22 | +- Open your Unity project. |
| 23 | +- Drag and drop the `TutorialSystem` folder into your `Assets` directory. |
| 24 | + |
| 25 | +### 3️⃣ Add the `UITutorialManager` to Your Scene |
| 26 | +1. Create an empty GameObject and name it **`UITutorialManager`**. |
| 27 | +2. Attach the **`UITutorialManager.cs`** script. |
| 28 | +3. Assign: |
| 29 | + - **Overlay Panel** (to dim the screen during tutorials). |
| 30 | + - **Tooltip Prefab |
| 31 | + - <img width="964" alt="Screenshot 2025-03-20 at 7 56 01 PM" src="https://github.com/user-attachments/assets/e9e8ad5b-2aa4-467d-bbfc-a241493716ee" /> |
| 32 | +** (for showing instructions). |
| 33 | + |
| 34 | +<img width="496" alt="Screenshot 2025-03-20 at 7 53 50 PM" src="https://github.com/user-attachments/assets/8a479f78-052b-40d1-89d6-5c0d0e98705a" /> |
| 35 | + |
| 36 | + |
| 37 | +### 4️⃣ Define Your Buttons |
| 38 | +1. Create a `ScriptableObject` for buttons: |
| 39 | + - **Go to** `Assets > Create > UI > Buttons DB` |
| 40 | + - Name it `ButtonsDatabase`. |
| 41 | + - Add the button names. |
| 42 | + - Click `Generate Enum` (or use `Tools > ButtonID Enum Generator`). |
| 43 | +<img width="624" alt="Screenshot 2025-03-20 at 7 57 39 PM" src="https://github.com/user-attachments/assets/9f281ad2-16fe-477f-aca3-d93646a2cda4" /> |
| 44 | +<img width="513" alt="Screenshot 2025-03-20 at 7 56 44 PM" src="https://github.com/user-attachments/assets/5c7a7573-9449-41b5-a8c6-cb1d7677e020" /> |
| 45 | + |
| 46 | +2. **IMPORTANT!!** Add UIButton.cs to every button you want highlighted |
| 47 | +3. **IMPORTANT!!** For every button you want highlighted, Assign `ButtonID` to each UI button in the Inspector. |
| 48 | + |
| 49 | + |
| 50 | +### 5️⃣ Create Tutorial Sequences |
| 51 | +1. **Go to** `Assets > Create > UI > SequenceID DB`. |
| 52 | +2. Add a new `SequenceDatabase`. |
| 53 | +3. List the tutorial sequence names. |
| 54 | +4. Click `Generate Enum`. |
| 55 | +5. Assign tutorial sequences in `UITutorialManager`. |
| 56 | +<img width="624" alt="Screenshot 2025-03-20 at 7 57 39 PM" src="https://github.com/user-attachments/assets/423380f4-3fd5-436e-b828-b482f1dfe5d0" /> |
| 57 | +<img width="510" alt="Screenshot 2025-03-20 at 7 56 57 PM" src="https://github.com/user-attachments/assets/78338707-71cf-4a11-9a38-65fa76a886f5" /> |
| 58 | + |
| 59 | + |
| 60 | +### 6️⃣ Install `NaughtyAttributes` (Optional) |
| 61 | +To take advantage of enhanced Inspector UI flexibility, install the **NaughtyAttributes** package: |
| 62 | +- **Download from GitHub**: [NaughtyAttributes Repository](https://github.com/dbrizov/NaughtyAttributes) |
| 63 | +- **Import into Unity** via Package Manager. |
| 64 | +- This allows for better Inspector usability in the project. |
| 65 | + |
| 66 | +--- |
| 67 | + |
| 68 | +## 📌 How to Use |
| 69 | +### 🎯 Starting a Tutorial |
| 70 | +Call the `StartTutorial` function with a `SequenceID`: |
| 71 | +```csharp |
| 72 | +UITutorialManager tutorialManager = FindObjectOfType<UITutorialManager>(); |
| 73 | +tutorialManager.StartTutorial(SequenceID.seq_shop); |
| 74 | +``` |
| 75 | + |
| 76 | +### 🎯 Highlight a Button with a Tooltip |
| 77 | +```csharp |
| 78 | +tutorialManager.FocusOnButton(ButtonID.shop, "Click here to open the shop!"); |
| 79 | +``` |
| 80 | + |
| 81 | +### 🎯 Ending a Tutorial |
| 82 | +```csharp |
| 83 | +tutorialManager.EndTutorial(); |
| 84 | +``` |
| 85 | +--- |
| 86 | + |
| 87 | +## 🛠️ Customization |
| 88 | +### 🖊️ Modify Tooltip Appearance |
| 89 | +- Edit the **TooltipUI Prefab** to change text styles, colors, or animations. |
| 90 | +- Modify `TooltipUI.cs` to change how tooltips position themselves. |
| 91 | + |
| 92 | +### ⚡ Add Custom Logic to Steps |
| 93 | +Each step can execute custom logic using the `OnStepCompleted` event: |
| 94 | +```csharp |
| 95 | +var step = new UITutorialStep { |
| 96 | + buttonID = ButtonID.shop, |
| 97 | + message = "Click here to open the shop!", |
| 98 | + OnStepCompleted = () => Debug.Log("Shop button clicked!") |
| 99 | +}; |
| 100 | +``` |
| 101 | +### Here are some visuals of how a well setup project should look like in action |
| 102 | +<img width="289" alt="Screenshot 2025-03-20 at 7 54 55 PM" src="https://github.com/user-attachments/assets/84fc3a92-5012-417c-8d7d-a1e7a8981b15" /> |
| 103 | +<img width="289" alt="Screenshot 2025-03-20 at 7 55 22 PM" src="https://github.com/user-attachments/assets/b5fa6760-a802-4a99-8d14-24a88390085b" /> |
| 104 | + |
| 105 | + |
| 106 | +### 🎛️ Adjust Button Highlight Effects |
| 107 | +Modify `UIButton.cs` to change how buttons are visually highlighted during a tutorial. |
| 108 | + |
| 109 | +--- |
| 110 | + |
| 111 | +## 🤝 Contributing |
| 112 | +We welcome contributions! Feel free to **fork** the project, submit **pull requests**, or **report issues**. |
| 113 | + |
| 114 | +### ✅ How to Contribute |
| 115 | +1. **Fork the repository**. |
| 116 | +2. **Create a new branch** (`feature/tutorial-improvement`). |
| 117 | +3. **Make your changes & commit**. |
| 118 | +4. **Push the branch & open a PR**. |
| 119 | + |
| 120 | +--- |
| 121 | + |
| 122 | +## 📅 Future Improvements |
| 123 | +- **👀 UI Animation System** – Add smooth transitions for highlighting buttons. |
| 124 | +- **📖 Localization Support** – Multi-language support for tutorials. |
| 125 | +- **📊 Analytics Integration** – Track tutorial completion rates. |
| 126 | + |
| 127 | +--- |
| 128 | + |
| 129 | +## 📜 License |
| 130 | +This project is licensed under the **MIT License**. Feel free to use and modify it! |
| 131 | + |
| 132 | +--- |
| 133 | + |
| 134 | +## 👏 Credits |
| 135 | +Developed by **[Your Name]**. Inspired by various UI tutorials in the gaming industry. |
| 136 | + |
| 137 | +--- |
| 138 | + |
| 139 | +## ⭐ Support the Project |
| 140 | +If you find this useful, **give it a ⭐ on GitHub**! 🚀 |
| 141 | + |
0 commit comments