AActor is already have code to detect mouse hovers and clicks and had delegates you can use
They puts UI in to account, you also need to set bEnableMouseOverEvents to true in player controller, this able line tracing so set it to false when you don’t need it