First, double-click to import the required NGUI package.
The following is the import prompt. We need to import all of them here.
Project file after NGUI Import
After importing NGUI, The NGUI option will appear in the top menu bar. Delete the default Main Camera and create a New UI.
When you create a new UI, the following
The next step is to create the NGUI component and create a widget.
The widget tool window appears after you click it.
When you click the template in the window, the following list is displayed, showing NGUI components. Here we will use the label and button components.
All the image materials in NGUI need to be read from atlas. Here we use NGUI materials.
Drag two items to the widget tool, select button, add to panel, and each component requires a parent node. Here we select panel as the parent node.
Here we select label as the template and add to panel.
In this way, we have added two components: button and text. Next, we will add a script to connect the two components.
Create the script btn_click_1 with the following content:
Drag the script to the button script, select the script, and pull the label component to the LB variable in the script.
Completed: