Skip to main content

ULCKBaseButton

Base class for all UI button components providing touch interaction, visual state management, and event delegation.

Properties

PropertyTypeDescription
ButtonTypeELCKButtonTypeButton shape type
CollisionBoxUBoxComponent*Touch collision detection
ButtonSmcUStaticMeshComponent*Visual mesh
ButtonLabelUTextRenderComponent*Text label
ButtonNameFNameIdentifier
PressedOffsetFVectorVisual offset when pressed

Events

OnTapStarted
FOnTapStarted
Broadcast when button is tapped.
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnTapStarted);

Methods

MethodDescription
ButtonPressed(TapData)Handle press input
ButtonReleased(TapData)Handle release input
UpdateVisualsOnPressed()Set pressed visual state
UpdateVisualsOnReleased()Set released visual state
Show()Make visible
Hide()Make hidden
SetUVOffset(UVOffset)Set primary UV offset
SetSecondUVOffset(UVOffset)Set secondary UV offset

Example

ULCKBaseButton* Button = CreateDefaultSubobject<ULCKBaseButton>(TEXT("ActionButton"));
Button->SetupAttachment(RootComponent);
Button->ButtonName = TEXT("MyAction");

Button->OnTapStarted.AddDynamic(this, &AMyActor::HandleButtonTap);

void AMyActor::HandleButtonTap()
{
    UE_LOG(LogTemp, Log, TEXT("Button tapped!"));
}

ULCKToggle

Toggle button with on/off states and state-dependent icons.

Properties

PropertyTypeDescription
ToggleOnIconUTexture2D*Icon for on state
ToggleOffIconUTexture2D*Icon for off state

Methods

MethodDescription
UpdateVisuals(bIsOn)Update appearance based on state

Derived Classes

Microphone toggle button with mute/unmute icons.
Camera follow mode toggle for selfie camera.
Landscape/portrait orientation toggle.
Rectangle-shaped toggle button.

Example

ULCKToggle* MicToggle = CreateDefaultSubobject<ULCKToggle>(TEXT("MicToggle"));
MicToggle->ToggleOnIcon = MicOnTexture;
MicToggle->ToggleOffIcon = MicOffTexture;

MicToggle->OnTapStarted.AddDynamic(this, &AMyActor::OnMicToggled);

void AMyActor::OnMicToggled()
{
    bMicEnabled = !bMicEnabled;
    MicToggle->UpdateVisuals(bMicEnabled);
    Service->SetMicrophoneEnabled(bMicEnabled);
}

ULCKRectButton

Rectangle-shaped button for text labels and actions.

Derived Classes

Camera flip/mirror toggle button.

ULCKRecordButton

Record button with time display and recording state visualization.

Interfaces

Implements ILCKRecordable.

Events

OnRecordButtonPressed
FOnRecordButtonPressed
Broadcast when record button is pressed.
DECLARE_MULTICAST_DELEGATE_OneParam(FOnRecordButtonPressed, ILCKRecordable*);

Methods

MethodDescription
SetTime(NewTime)Update displayed recording time
UpdateVisuals(NewState)Update for recording state

Example

ULCKRecordButton* RecordButton = CreateDefaultSubobject<ULCKRecordButton>(TEXT("RecordButton"));

RecordButton->OnRecordButtonPressed.AddLambda([this](ILCKRecordable* Recordable) {
    if (Service->IsRecording())
    {
        Service->StopRecording();
        Recordable->UpdateVisuals(ELCKRecordingState::Saving);
    }
    else
    {
        Service->StartRecording();
        Recordable->UpdateVisuals(ELCKRecordingState::Recording);
    }
});

// Update time display during recording
void AMyActor::Tick(float DeltaTime)
{
    if (Service->IsRecording())
    {
        RecordButton->SetTime(Service->GetCurrentRecordingDuration());
    }
}

ULCKVideoQualityButton

Video quality selection button cycling through SD, HD, 2K, 4K presets.

ULCKOnScreenButton

Button rendered on the display surface for in-viewport interaction.

Derived Classes

Flip button on display surface.
Photo capture button on display surface.

Touch Interaction

Enabling Interactions

Interaction with the UI is collision-based. The simplest way to enable interactions is to add a SphereCollider with 5-10mm radius to the index fingertip. Finger collider setup Make sure that the collider has the UICollision tag. It’s used to filter collision for UI. UICollision tag

FLCKTapData

Touch event data structure.
USTRUCT()
struct LCKUI_API FLCKTapData
{
    FVector ButtonLocation;      // World position of button
    FVector ButtonRightVector;   // Button's right vector
    FVector ButtonForwardVector; // Button's forward vector
    FVector TapLocation;         // World position of tap
    bool IsPressed;              // Currently pressed state
};

Interaction Direction

Configure which direction validates touch input:
UENUM(BlueprintType)
enum class ELCKButtonInteractionDirection : uint8
{
    Forward,  // Touch must come from front
    Up        // Touch must come from above
};

Button->SetButtonInteractionDirection(ELCKButtonInteractionDirection::Forward);

Cooldown

Buttons have a built-in 0.25s cooldown to prevent accidental double-taps. This is handled automatically by FLCKConstants::CoolDownTime.
Don’t add additional cooldown logic in your code - the SDK handles this automatically.