Poly Plaza’s UI framework combines the power of Unreal Engine’s widget system with Lua scripting, allowing you to create dynamic interfaces that seamlessly integrate with the game’s visual style.
Understanding the UI System
The UI system in Poly Plaza works by creating a bridge between Lua scripts and Unreal Engine’s widget system. When you create a UI through Lua, you’re actually:- Creating a UI instance that can be shown/hidden
- Defining a data structure that describes your UI
- Letting the game engine convert that data into actual widgets
All UIs in Poly Plaza are created using the
CreateUI() function and require a ui table that defines their structure.Creating Your First UI
Here’s how to create a basic UI:Understanding the UI Structure
Every UI in Poly Plaza requires a specific structure:elements array must have at least:
- A
typefield specifying what kind of element it is - Additional fields depending on the element type
UI Element Types
Text Elements
Text elements display static or dynamic text:Buttons
Buttons allow user interaction:Input Fields
Input fields allow text input from users:Images
Display images in your UI:Layout Containers
Basic Container
Group elements together:Grid Container
Organize elements in a grid layout:Dynamic UIs
You can update UI content at any time by modifying theui table:
Managing UI State
Best practices for managing UI state:1. Single UI Instance
Keep a reference to your UI instance if you plan to reuse it:2. Updating Content
Update specific parts of your UI when needed:3. Cleanup
Hide UIs when they’re no longer needed:Complete Example: Shop System
Here’s a complete example of a shop system with dynamic content:Tips for Complex UIs
Performance
Performance
- Create UIs once and reuse them
- Only update parts of the UI that changed
- Hide UIs instead of destroying them
- Be mindful of the number of elements
User Experience
User Experience
- Provide feedback for all user actions
- Keep interfaces consistent
- Make sure text is readable
- Add appropriate spacing between elements
- Use clear and concise labels
Code Organization
Code Organization
- Split complex UIs into functions
- Keep UI logic separate from game logic
- Comment your code
- Use meaningful variable names
Next Steps
Join Discord
Get help from the modding community
Youtube tutorials
Check out more examples with my video tutorials