Navigation
API > API/Runtime > API/Runtime/UMG
This is a component to allow interaction with the Widget Component. This class allows you to simulate a sort of laser pointer device, when it hovers over widgets it will send the basic signals to show as if the mouse were moving on top of it. You'll then tell the component to simulate key presses, like Left Mouse, down and up, to simulate a mouse click.
| Name | UWidgetInteractionComponent |
| Type | class |
| Header File | /Engine/Source/Runtime/UMG/Public/Components/WidgetInteractionComponent.h |
| Include Path | #include "Components/WidgetInteractionComponent.h" |
Syntax
UCLASS (ClassGroup="UserInterface", Meta=(BlueprintSpawnableComponent), MinimalAPI)
class UWidgetInteractionComponent : public USceneComponent
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UActorComponent → USceneComponent → UWidgetInteractionComponent
Implements Interfaces
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
UWidgetInteractionComponent
(
const FObjectInitializer& ObjectInitializer |
Components/WidgetInteractionComponent.h |
Structs
| Name | Remarks |
|---|---|
| FWidgetTraceResult |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bEnableHitTesting | bool | Should the interaction component perform hit testing (Automatic or Custom) and attempt to simulate hover - if you were going to emulate a keyboard you would want to turn this option off if the virtual keyboard was separate from the virtual pointer device and used a second interaction component. | Components/WidgetInteractionComponent.h |
|
| bShowDebug | bool | Shows some debugging lines and a hit sphere to help you debug interactions. | Components/WidgetInteractionComponent.h |
|
| DebugColor | FLinearColor | Determines the color of the debug lines. | Components/WidgetInteractionComponent.h |
|
| DebugLineThickness | float | Determines the thickness of the debug lines. | Components/WidgetInteractionComponent.h |
|
| DebugSphereLineThickness | float | Determines the line thickness of the debug sphere. | Components/WidgetInteractionComponent.h |
|
| InteractionDistance | float | The distance in game units the component should be able to interact with a widget component. | Components/WidgetInteractionComponent.h |
|
| InteractionSource | EWidgetInteractionSource | Should we project from the world location of the component? If you set this to false, you'll need to call SetCustomHitResult(), and provide the result of a custom hit test form whatever location you wish. | Components/WidgetInteractionComponent.h |
|
| OnHoveredWidgetChanged | FOnHoveredWidgetChanged | Called when the hovered Widget Component changes. | Components/WidgetInteractionComponent.h |
|
| PointerIndex | int32 | Each user virtual controller or virtual finger tips being simulated should use a different pointer index. | Components/WidgetInteractionComponent.h |
|
| TraceChannel | TEnumAsByte< ECollisionChannel > | The trace channel to use when tracing for widget components in the world. | Components/WidgetInteractionComponent.h |
|
| VirtualUserIndex | int32 | Represents the Virtual User Index. | Components/WidgetInteractionComponent.h |
|
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| ArrowComponent | TObjectPtr< class UArrowComponent > | The arrow component we show at editor time. | Components/WidgetInteractionComponent.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FVector2D Get2DHitLocation() |
Gets the last hit location on the widget in 2D, local pixel units of the render target. | Components/WidgetInteractionComponent.h |
|
UWidgetComponent * GetHoveredWidgetComponent() |
Get the currently hovered widget component. | Components/WidgetInteractionComponent.h |
|
const FWeakWidgetPath & GetHoveredWidgetPath() |
Gets the widget path for the slate widgets under the last hit result. | Components/WidgetInteractionComponent.h | |
const FHitResult & GetLastHitResult() |
Gets the last hit result generated by the component. Returns the custom hit result if that was set. | Components/WidgetInteractionComponent.h |
|
bool IsOverFocusableWidget () |
Returns true if a widget under the hit result is focusable. | Components/WidgetInteractionComponent.h |
|
bool IsOverHitTestVisibleWidget () |
Returns true if a widget under the hit result is has a visibility that makes it hit test visible. | Components/WidgetInteractionComponent.h |
|
bool IsOverInteractableWidget () |
Returns true if a widget under the hit result is interactive. | Components/WidgetInteractionComponent.h |
|
virtual bool PressAndReleaseKey
(
FKey Key |
Does both the press and release of a simulated keyboard key. | Components/WidgetInteractionComponent.h |
|
| Press a key as if it had come from the keyboard. | Components/WidgetInteractionComponent.h |
|
|
virtual void PressPointerKey
(
FKey Key |
Presses a key as if the mouse/pointer were the source of it. | Components/WidgetInteractionComponent.h |
|
virtual bool ReleaseKey
(
FKey Key |
Releases a key as if it had been released by the keyboard. | Components/WidgetInteractionComponent.h |
|
virtual void ReleasePointerKey
(
FKey Key |
Releases a key as if the mouse/pointer were the source of it. | Components/WidgetInteractionComponent.h |
|
virtual void ScrollWheel
(
float ScrollDelta |
Sends a scroll wheel event to the widget under the last hit result. | Components/WidgetInteractionComponent.h |
|
virtual bool SendKeyChar
(
FString Characters, |
Transmits a list of characters to a widget by simulating a OnKeyChar event for each key listed in the string. | Components/WidgetInteractionComponent.h |
|
void SetCustomHitResult
(
const FHitResult& HitResult |
Set custom hit result. | Components/WidgetInteractionComponent.h |
|
void SetFocus
(
UWidget* FocusWidget |
Set the focus target of the virtual user managed by this component | Components/WidgetInteractionComponent.h |
|
Overridden from UActorComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void Activate
(
bool bReset |
Components/WidgetInteractionComponent.h | ||
virtual void Deactivate() |
Components/WidgetInteractionComponent.h | ||
virtual void OnComponentCreated() |
Components/WidgetInteractionComponent.h | ||
virtual void TickComponent
(
float DeltaTime, |
Components/WidgetInteractionComponent.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool CanInteractWithComponent
(
UWidgetComponent* Component |
Returns true if the inteaction component can interact with the supplied widget component | Components/WidgetInteractionComponent.h | |
bool CanSendInput() |
Is it safe for this interaction component to run? Might not be in a server situation with no slate application. | Components/WidgetInteractionComponent.h | |
virtual FWidgetPath FindHoveredWidgetPath
(
const FWidgetTraceResult& TraceResult |
Gets the WidgetPath for the widget being hovered over based on the hit result. | Components/WidgetInteractionComponent.h | |
void GetKeyAndCharCodes
(
const FKey& Key, |
Gets the key and char codes for sending keys for the platform. | Components/WidgetInteractionComponent.h | |
void GetRelatedComponentsToIgnoreInAutomaticHitTesting
(
TArray< UPrimitiveComponent* >& IgnorePrimitives |
Gets the list of components to ignore during hit testing. | Components/WidgetInteractionComponent.h | |
virtual FWidgetTraceResult PerformTrace() |
Performs the trace and gets the hit result under the specified InteractionSource | Components/WidgetInteractionComponent.h | |
void SimulatePointerMovement() |
Performs the simulation of pointer movement. Does not run if bEnableHitTesting is set to false. | Components/WidgetInteractionComponent.h |