Building user interfaces in Unity often involves navigating deeply nested menus. Coplay simplifies this by allowing you to generate entire UI windows from natural language, automatically hook up logic, and ensure new elements match your existing project style.Documentation Index
Fetch the complete documentation index at: https://docs.coplay.dev/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before starting this tutorial, ensure you have:
- Unity installed with the Coplay extension.
- The Active Scene and File Tree context enabled in your Coplay settings.
- A basic understanding of Unity’s UGUI or UI Toolkit.
Define Your UI Structure
Instead of a vague request like “Make a menu,” provide a structural prompt. This helps Coplay understand the hierarchy of the window you want to build.Example Prompt:
Style Matching & Consistency
To ensure your new UI doesn’t look out of place, use Coplay to analyze your existing assets.
- Pin your source: Use the
@symbol to reference an existing UI Prefab. - Prompt for matching: “Create a new ‘Level Up’ popup that matches the button styles, fonts, and color palette of
@MainHUD_Prefab.”
Save as Prefabs
AI-generated UI is most useful when it’s reusable. Once you are happy with a layout, instruct Coplay to save it.Prompt:
Hook Up C# Logic
After the visual elements are in place, bridge the gap to your game code.
- Example: “Reference the
@UIManager.csscript and hook up the ‘Back’ button’sOnClickevent to theCloseCurrentWindow()method.”
Managing 'Context Rot'
As your UI becomes more complex, the AI can experience “context rot” over long sessions.The Workflow Fix: - Once a specific window is built and saved as a prefab, Start a New Thread.
- This clears out the old “designing” noise and gives the AI a fresh head-start for the next task, such as coding the data-binding or animations.
🎥 Video Tutorials
Check out these walkthroughs to see these workflows in action:Generating UI Prefabs
Learn how to create and save complex windows from an image.
AI UI Logic
Connecting buttons to C# methods with AI (Coming Soon).
Pro Tip: For high-stakes UI work, use StepByStep Mode. It allows you to approve each layout group adjustment before the AI proceeds, preventing messy hierarchies.