User Interface
Samples in this section illustrate the use of the GUI-Related classes.
Target Marker#
Implementation of a marker that always highlights the target when it is within the field of view, or displays an arrow pointing the direction to the target when it is out of sight (aligned with the screen borders).
SDK Path: <SDK_INSTALLATION>data/csharp_component_samples/user_interface/target_marker
User Interface#
This sample shows how to generate a User Interface from a description stored in a .ui file (XML format) via C++ API. The sample also demonstrates how to get a UI widget by name via getWidgetByName() and subscribe to events to implement custom handling for user actions (particularly selecting File -> Reload from the main menu or entering text in the text field on the EditText tab).
SDK Path: <SDK_INSTALLATION>data/csharp_component_samples/user_interface/user_interface
Widget Canvas#
This sample demonstrates how to use the WidgetCanvas class to draw vector-based shapes and text. The canvas supports adding lines, polygons, and text by defining their geometry through vertex positions. Elements are layered by draw order and colored individually.
The canvas content remains sharp regardless of scaling or rotation. In this example, the entire canvas is transformed over time, rotating and moving in 3D space while preserving the clarity of its contents. The geometry is built using helper functions that generate radial lines and regular polygons, and the layout is updated every frame using a transformation matrix.
This can be used to create clean, scalable UI elements, procedural charts, custom overlays, or dynamic data visualizations in tools or applications.
SDK Path: <SDK_INSTALLATION>data/csharp_component_samples/user_interface/widget_canvas
Widget Containers#
Demonstration of various types of widget containers (vertical and horizontal box layouts, paned widgets, tabbed interfaces, group boxes, grid-based container, etc.) you can use when creating a User Interface.
The WidgetsContainers.cs component shows how to use various layout and grouping widgets from the Gui class to organize interface elements. It demonstrates vertical and horizontal box layouts, paned widgets, tabbed interfaces, group boxes, grid-based containers, and scrollable areas.
Each container is filled with labeled elements and styled with background colors to illustrate their visual separation and hierarchy. The interface is fully constructed and added to the main GUI at runtime, then removed on shutdown.
SDK Path: <SDK_INSTALLATION>data/csharp_component_samples/user_interface/widget_containers
Widget Dialog#
This sample demonstrates how to create and manage a GUI dialog system using UNIGINE's dialog widgets via the C++ API. A WidgetWindow instance contains several buttons, each opening a different type of dialog: WidgetDialogMessage, WidgetDialogFile, WidgetDialogColor, or WidgetDialogImage.
Each button is connected to an event handler that creates and configures the corresponding dialog widget. Dialogs are shown centered on screen and support user interaction through OK and Cancel buttons. A shared handler manages these responses, logs actions to the console, and deletes the dialog afterward to clean up resources.
This approach can be used to build simple and interactive GUI tools, settings panels, or development utilities that require built-in dialog interactions.
SDK Path: <SDK_INSTALLATION>data/csharp_component_samples/user_interface/widget_dialog
Widget Window#
This sample demonstrates how to create a basic WidgetWindow using the C++ API and handle user interactions (edit line and button press events) through handler function connections.
The window includes a WidgetEditLine and a WidgetButton. The WidgetEditLine listens for text changes via Widget::getEventChanged() and logs the new input, while the WidgetButton uses Widget::getEventClicked() to trigger an action when pressed. Font sizes are adjusted for better readability, and the layout is arranged automatically.
This approach is suitable for building interactive UI elements directly within UNIGINE's native GUI system.
SDK Path: <SDK_INSTALLATION>data/csharp_component_samples/user_interface/widget_window
Widgets#
This sample demonstrates the implementation of various UI widgets in UNIGINE. It showcases how to create, configure and manage interactive GUI elements.
The sample includes multiple widget types with event handling capabilities, demonstrating how to create and position widgets, configure visual properties, handle user interactions, etc., such as sliders, scrolls, buttons, checkboxes, drop-down lists, etc.
SDK Path: <SDK_INSTALLATION>data/csharp_component_samples/user_interface/widgets
The information on this page is valid for UNIGINE 2.20 SDK.