Home
  • English
  • 中文
Home
  • English
  • 中文
  • Get Started

    • Install
    • Hello LGUI
    • Custom Button
    • Use custom font
    • Prefab workflow
    • Interaction
    • Button from scratch
  • Sample Projects

    • Sample Projects
  • Prefab Workflow

    • LGUI Prefab
    • PrefabEditor
    • LGUILifeCycleBehaviour
    • LGUIPrefabInterface
  • Rendering

    • LGUICanvas
    • Screen Space Overlay
    • World Space - UE Renderer
    • World Space - LGUI Renderer
    • LGUI render flow
    • UICanvasGroup
  • Visual Components

    • UIText
    • UIEffect
    • TextAnimation
    • UIBackgroundBlur
    • UIBackgroundPixelate
  • Events

    • LGUIEventDelegate
    • LGUIEventSystem
  • Interaction Components

    • UISelectable component
  • Layout

    • Basic Layout
    • Auto Layout
  • Tween Animation

    • LTween
    • Use LTween for UI element
  • Performance

    • LGUI Stat
  • ReleaseNotes

    • LGUI 3.x
    • LGUI 2.x
  • FAQ

    • Why use prefab?
    • Update project from LGUI2 to LGUI3
    • Project 3d world position to LGUI's screen 2d position
    • Deproject LGUI's screen position to world
    • Use custom material for UI elements
    • Disable interaction component
    • Find Child by DisplayName
    • Get actor or component inside prefab
    • Anti-aliasing

Hello LGUI

In this section, we will create a simple UI that show "Hello LGUI" step by step.
icon

Create Screen Space UI

Create a new default level, click "LGUI Editor Tools"->"Basic Setup"->"Screen Space UI":
step1

Then a preset screen space UI should appear:
step2

Create a button

Select ScreenSpaceUIRoot, right click on the down arrow in the "LGUI" column:
step3

Click "Create UI Element"->"UIButton":
step4

Then a button will appear in viewport and outliner:
step5

Adjust button

Select "Button" in Outliner, change the "PosZ" to -120, this will move the button a little off the center in vertical direction:
step6

Add OnClick event

Select "UIButton" component on "Button" actor, find "On Click()" property and click the "+" button:
step7

The "On Click" is a LGUIEventDelegate (see LGUIEventDelegate page), it has four parameters(Actor, Component, Function, Parameter):
step8

In "Actor" parameter, select "Info" object from World Outliner:
step9

Click "Component" area and select "UITextComponent":
step10

Click "Function" area and select "SetText(Text)":
step11

Now the "Parameter" area become a text input block, type in "Hello LGUI":
step12

Hit Play, then move you mouse to the button, you will see it highlighted:
step13 Then click the button, you will see the text change:
step14

Last Updated:
Contributors: lf2007hf
Prev
Install
Next
Custom Button