UE4 mouse click selection

UE4 mouse click selection

Recently, I wanted to make a mouse selection highlighting function, so I thought of doing UE4's mouse click selection function.

  1. The first is to check the mouse click event in the playercontroller:
    insert image description here
  2. Then set according to the desired detection method:
    if you want to use the capsule to detect the mouse click event, you must first set the collision of the capsule, check the visibility block,
    insert image description here
    and then call the click event of the capsule to respond Mouse click.
    insert image description here
    insert image description here
    If you want to use the mesh to respond to mouse clicks, you have to change the collision type of the mesh to UI:
    insert image description here
    after that, you can also call the oncliked event of the mesh to respond.
    However, after testing, it is found that if only the visibility channel of the mesh is changed to a block, the click cannot be responded to. The specific reason is not clear.

Guess you like

Origin blog.csdn.net/weixin_44840850/article/details/119276220