![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <WidgetInteractionComponent.h>
Inheritance diagram for UWidgetInteractionComponent:Classes | |
| struct | FWidgetTraceResult |
Protected Member Functions | |
| UMG_API void | GetKeyAndCharCodes (const FKey &Key, bool &bHasKeyCode, uint32 &KeyCode, bool &bHasCharCode, uint32 &CharCode) |
| UMG_API bool | CanSendInput () |
| UMG_API void | SimulatePointerMovement () |
| virtual UMG_API FWidgetPath | FindHoveredWidgetPath (const FWidgetTraceResult &TraceResult) const |
| virtual UMG_API FWidgetTraceResult | PerformTrace () const |
| UMG_API void | GetRelatedComponentsToIgnoreInAutomaticHitTesting (TArray< UPrimitiveComponent * > &IgnorePrimitives) const |
| UMG_API bool | CanInteractWithComponent (UWidgetComponent *Component) const |
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.
| UWidgetInteractionComponent::UWidgetInteractionComponent | ( | const FObjectInitializer & | ObjectInitializer = FObjectInitializer::Get() | ) |
|
protected |
Returns true if the inteaction component can interact with the supplied widget component
|
protected |
Is it safe for this interaction component to run? Might not be in a server situation with no slate application.
|
overridevirtual |
|
protectedvirtual |
Gets the WidgetPath for the widget being hovered over based on the hit result.
| FVector2D UWidgetInteractionComponent::Get2DHitLocation | ( | ) | const |
Gets the last hit location on the widget in 2D, local pixel units of the render target.
| UWidgetComponent * UWidgetInteractionComponent::GetHoveredWidgetComponent | ( | ) | const |
Get the currently hovered widget component.
| const FWeakWidgetPath & UWidgetInteractionComponent::GetHoveredWidgetPath | ( | ) | const |
Gets the widget path for the slate widgets under the last hit result.
|
protected |
| const FHitResult & UWidgetInteractionComponent::GetLastHitResult | ( | ) | const |
Gets the last hit result generated by the component. Returns the custom hit result if that was set.
|
protected |
Gets the list of components to ignore during hit testing. Which is everything that is a parent/sibling of this component that's not a Widget Component. This is so traces don't get blocked by capsules and such around the player.
| bool UWidgetInteractionComponent::IsOverFocusableWidget | ( | ) | const |
Returns true if a widget under the hit result is focusable. e.g. Slate widgets that return true for SupportsKeyboardFocus().
| bool UWidgetInteractionComponent::IsOverHitTestVisibleWidget | ( | ) | const |
Returns true if a widget under the hit result is has a visibility that makes it hit test visible. e.g. Slate widgets that return true for GetVisibility().IsHitTestVisible().
| bool UWidgetInteractionComponent::IsOverInteractableWidget | ( | ) | const |
Returns true if a widget under the hit result is interactive. e.g. Slate widgets that return true for IsInteractable().
|
overridevirtual |
|
protectedvirtual |
Performs the trace and gets the hit result under the specified InteractionSource
Does both the press and release of a simulated keyboard key.
Press a key as if it had come from the keyboard. Avoid using this for 'a-z|A-Z', things like the Editable Textbox in Slate expect OnKeyChar to be called to signal a specific character being send to the widget. So for those cases you should use SendKeyChar.
Presses a key as if the mouse/pointer were the source of it. Normally you would just use Left/Right mouse button for the Key. However - advanced uses could also be imagined where you send other keys to signal widgets to take special actions if they're under the cursor.
Releases a key as if it had been released by the keyboard.
Releases a key as if the mouse/pointer were the source of it. Normally you would just use Left/Right mouse button for the Key. However - advanced uses could also be imagined where you send other keys to signal widgets to take special actions if they're under the cursor.
Sends a scroll wheel event to the widget under the last hit result.
Transmits a list of characters to a widget by simulating a OnKeyChar event for each key listed in the string.
| void UWidgetInteractionComponent::SetCustomHitResult | ( | const FHitResult & | HitResult | ) |
Set custom hit result. This is only taken into account if InteractionSource is set to EWidgetInteractionSource::Custom.
Set the focus target of the virtual user managed by this component
|
protected |
Performs the simulation of pointer movement. Does not run if bEnableHitTesting is set to false.
|
overridevirtual |
| bool UWidgetInteractionComponent::bEnableHitTesting |
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.
|
protected |
Are we hovering over any focusable widget?
|
protected |
Are we hovered over a widget that is hit test visible?
|
protected |
Are we hovering over any interactive widgets.
| bool UWidgetInteractionComponent::bShowDebug |
Shows some debugging lines and a hit sphere to help you debug interactions.
|
protected |
Stores the custom hit result set by the player.
| FLinearColor UWidgetInteractionComponent::DebugColor |
Determines the color of the debug lines.
| float UWidgetInteractionComponent::DebugLineThickness |
Determines the thickness of the debug lines.
| float UWidgetInteractionComponent::DebugSphereLineThickness |
Determines the line thickness of the debug sphere.
|
protected |
DEPRECATED - Use WeakHoveredWidgetComponent instead
| float UWidgetInteractionComponent::InteractionDistance |
The distance in game units the component should be able to interact with a widget component.
| EWidgetInteractionSource UWidgetInteractionComponent::InteractionSource |
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.
|
protected |
The last hit result we used.
|
protected |
The last 2D location on the widget component that was hit.
|
protected |
The last widget path under the hit result.
|
protected |
The 2D location on the widget component that was hit.
|
protected |
The modifier keys to simulate during key presses.
| FOnHoveredWidgetChanged UWidgetInteractionComponent::OnHoveredWidgetChanged |
| int32 UWidgetInteractionComponent::PointerIndex |
Each user virtual controller or virtual finger tips being simulated should use a different pointer index.
|
protected |
The current set of pressed keys we maintain the state of.
| TEnumAsByte<ECollisionChannel> UWidgetInteractionComponent::TraceChannel |
The trace channel to use when tracing for widget components in the world.
|
protected |
Represents the virtual user in slate. When this component is registered, it gets a handle to the virtual slate user it will be, so virtual slate user 0, is probably real slate user 8, as that's the first index by default that virtual users begin - the goal is to never have them overlap with real input hardware as that will likely conflict with focus states you don't actually want to change - like where the mouse and keyboard focus input (the viewport), so that things like the player controller receive standard hardware input.
| int32 UWidgetInteractionComponent::VirtualUserIndex |
Represents the Virtual User Index. Each virtual user should be represented by a different index number, this will maintain separate capture and focus states for them. Each controller or finger-tip should get a unique PointerIndex.
|
protected |
The widget component we're currently hovering over.