Bug with DefaultClickTraceChannel

Hello,

In FWidget3DHitTester::GetHitResultAtScreenPositionAndCache the “ECC_Visibility” trace-channel is used for determining the clicked widget.

However, as you can change the default click-tracechannel to a different one from “ECC_Visibility” in the playercontroller, I would assume, that this is a bug ?

Regards

Hey -

I tried to test this by adding a widget component to an actor with a button “OnClicked” function set. After adding the actor to the level and setting my custom player controller’s “Default Click Trace Channel” to Vehicle, clicking the button in game still triggered its OnClicked function. Can you elaborate where you believe this is causing a problem and/or provide setup steps so that I can reproduce the problem on my end?

Hi ,

Our use-case is a widget-component inside of a capsule which already blocks the visibility-channel.

The problem only occurs, if the widget-component has a collision-type, which does not block the visibility-channel.

I have found two cases, where the primitivecomponent under the mouse is being tracked.

Case 1 works:

>	UE4Editor-Engine.dll!APlayerController::GetHitResultAtScreenPosition(const FVector2D ScreenPosition, const ECollisionChannel TraceChannel, bool bTraceComplex, FHitResult & HitResult) Zeile 1941	C++
 	UE4Editor-Engine.dll!APlayerController::TickPlayerInput(const float DeltaSeconds, const bool bGamePaused) Zeile 3846	C++

The second case does not seem to work, because it won’t find the widget which is not blocking the visibility channel:

>	UE4Editor-UMG.dll!FWidget3DHitTester::GetHitResultAtScreenPositionAndCache(APlayerController * PlayerController, FVector2D ScreenPosition) Zeile 402	C++
 	UE4Editor-UMG.dll!FWidget3DHitTester::GetBubblePathAndVirtualCursors(const FGeometry & InGeometry, FVector2D DesktopSpaceCoordinate, bool bIgnoreEnabledStatus) Zeile 311	C++
 	UE4Editor-SlateCore.dll!FHittestGrid::GetWidgetPathAndDist(const FHittestGrid::FGridTestingParams & Params, const bool bIgnoreEnabledStatus) Zeile 620	C++
 	UE4Editor-SlateCore.dll!FHittestGrid::GetBubblePath(FVector2D DesktopSpaceCoordinate, float CursorRadius, bool bIgnoreEnabledStatus) Zeile 143	C++
 	UE4Editor-Slate.dll!FSlateApplication::LocateWidgetInWindow(FVector2D ScreenspaceMouseCoordinate, const TSharedRef<SWindow,0> & Window, bool bIgnoreEnabledStatus) Zeile 1637	C++

Can you explain what is being done in each case or how you are setting up each case? If possible, please include precise steps so that I can reproduce the issue on my end.

Sorry, with “the first case” and “the second case” above, I meant the two code-paths in the engine where the method “GetHitResultAtScreenPositionAndCache” is used.

As far as I have seen, the button in your widget in your test-project would not get the “OnClicked” or the “OnBeginCursorOver” calls, if the widget-component ignores the visibility-channel.

So it should be just a matter of also changing the collision of the widget-component to reproduce it in your test-case.
(The widget-component should ignore the visibility-channel)

If that does not work on your side without problems, I could of course upload a test-project asap.

Then it would be a specific problem with our shape-setup.

Can you describe the behavior you’re seeing as well as what you believe the correct behavior is? When I change the Collision Preset of the widget component (from UI to Vehicle for example) it no longer interacts with mouse clicks since it it not registering as a UI element. If I change the Visibility of the button itself then either the button disappears or cannot be clicked depending on if it’s set to Collapse/Hidden vs Hit Test Invisible. This behavior is expected for each of these settings.

I have uploaded an example project, which is a copy of the FirstPersonProject.

Please have a look at:
http://178.254.10.124/ClickChannelTest.rar

I have changed the FirstPersonCharacter-Template, so that it shows our use-case:

There is a new “ClickChannelWidgetComponent” attached to the character, a new TraceChannel “UI” added in the Engine-collision-settings, a new “ClickChannelGameMode” added which uses the new “ClickChannelPlayercontroller” and in the Level-blueprint, is the inputmode changed, so that the mouse is shown from startup.

This widget has a button which reacts on MouseClick and on MouseHover during PIE.

So far, so good.

If I change now the collision of the capsule-component so that it blocks also the “visibility” channel like you can see in the attached picture, the widget will not be hit, as the capsule is always hit first.

I would expect that, if I use a different click-tracechannel than “Visibility”, to be able to get clicks on primitives which only block that channel.

But, “FWidget3DHitTester::GetHitResultAtScreenPositionAndCache” does not use “PlayerController::CurrentClickTraceChannel” but always “ECC_Visibility”.

Hope this helps

The download link leads to a 404 page. If you are able to zip the project, you can attach it to a comment here or provide a download link if you’re able to upload it to google drive or somewhere else.

Sorry, I thought the ip would be a bit longer valid.

https://drive.google.com/open?id=0B_QFVfBPpUHQYUpBZWQtREFsRHM

I see the behavior you’re referring to in your sample project. However I created a project with what appears to be the same setup that is overlapping/clicking as expected. To help me fully understand the difference in behavior, can you let me how the linked project differs from the one you sent me?

Sure.

There is a “FirstPersonCharacter” in the scene/world-outliner. He took the collision-settings from the one in the world and not from the template.

If you remove the instance from the world - the behavior is the same.

Hey -

I was able to reproduce the issue and have entered a bug report, UE-31338 , to investigate the behavior of the click channel settings.

Cheers

Thank you!