Thnx you all guys, this topic brought me to the right place and give great starting point! I am working with TopDown setup, Character need move to mouse click position and my widgets need work at this time.
I set in my LyraHUDLayoutInputConfig to Game and Menu, Game Mouse Capture to Capture Durning Mouse Down
The HUD and the C++ need to agree that the appropriate Input Mode is All (Game+Menu). And the mouse capture in my case was CapturePermanently_IncludingInitialMouseDown with an invisible mouse, and CaptureDuringMouseDown with a visible mouse.
Unfortunately this is a custom addition by Epic to the CommonUI plugin in Lyra.
In Lyra you can find Input Config in
Widget > Graph Editor Mode > Class Defaults
Hi @xi57 time has passed and I am currently on 5.2 preview2. As you said in this version CommonUIActionRouterBase.h has changed and the parameter ActiveInputConfig has been moved to protected:
Also looking at the file the ApplyUIInputConfig is now virtual. So regarding the topic of this thread what should I do to change the behaviour of ApplyUIInputConfig without compiling all the engine. Normally I override the classes and then I use this classes as base for blueprints, but how do i tell the engine to use my custom ApplyUIInputConfig?
There is some Unreal magic going on in the subsystem. During initialization, the subsystem will only initialize if there are no derived classes existing.
See for example:
bool UCommonUIActionRouterBase::ShouldCreateSubsystem(UObject* Outer) const
{
TArray<UClass*> ChildClasses;
GetDerivedClasses(GetClass(), ChildClasses, false);
UE_LOG(LogUIActionRouter, Display, TEXT("Found %i derived classes when attemping to create action router (%s)"), ChildClasses.Num(), *GetClass()->GetName());
// Only create an instance if there is no override implementation defined elsewhere
return ChildClasses.Num() == 0;
}
TLDR simply by you deriving a class from UCommonUIActionRouterBase and compiling it into your project, its existence will suppress the base class from initializing, and your class will be used instead.
So all you have to do is derive a child class and implement it. It will “automagically” replace the base subsystem.
UE 5.2 is releasing any day now, and I’ve published a new tutorial saying exactly how to take full control over the mouse in Lyra 5.2 (and thereby also CommonUI).
Sorry if I am not fully caught up with the problem you are trying to solve. I am developing on UE/Lyra 5.1 and I have cases where I want the mouse cursor to be captured but shown.
I noticed in FUIInputConfig there is a variable called bHideCursorDuringViewportCapture and by default it is set to true. Because in its constructor bHideCursorDuringViewportCapture has its default value, no parameter is required for this variable, causing this variable to be true all the time in Lyra.
In my project, I have an ActivatableWidget inheriting from LyraActivatableWidget and added bHideCursorDuringViewportCapture as a custom property. Then in GetDesiredInputConfig function, I simply passed the property to FUIInputConfig’s constructor to set whether the mouse is shown or not.
switch (InputConfig)
{
case ELyraWidgetInputMode::GameAndMenu:
return FUIInputConfig(ECommonInputMode::All, GameMouseCaptureMode, bHideCursorDuringViewportCapture);
case ELyraWidgetInputMode::Game:
return FUIInputConfig(ECommonInputMode::Game, GameMouseCaptureMode, bHideCursorDuringViewportCapture);
case ELyraWidgetInputMode::Menu:
return FUIInputConfig(ECommonInputMode::Menu, EMouseCaptureMode::NoCapture);
case ELyraWidgetInputMode::Default:
checkNoEntry();
default:
return TOptional<FUIInputConfig>();
}
Sorry if I misunderstood the issue you are trying to solve! Just posting it here in case it helps anyone.
I’m trying to use CommonUI (not Lyra) and I watched the whole video. I implemented the C++ function to set the Input Config on the UCommonUIActionRouterBase and I’m still getting the double click problem.
I have no idea what to do.
edit: Ok, I got it working. I didn’t have the main CommonUI widget’s “Is Focusable” set to true. Once I set it to true, it now works.
I actually found a solution by just unchecking “Supports Activation Focus” in the widget that im activating, allowing me to still read inputs from legacy input or enhanced input actions when “Game and UI input mode” is active
I’m working with blueprints (UE 5.3.2), and stumbled upon this easy solution:
Untick Enable Default Input Config, and now Set Input Mode function works like it should.
I didn’t check, so I don’t know if this is already documented.
It is possible this was mentioned before, but inside of a CommonActivatableWidget, there is an overridable function called GetDesiredInputConfig which can allow you to change input mode to Game, Menu, or All. It also has other settings that you can modify while that widget is active.