OnClicked not working in C++(works in bp)

For anyone running into this in the future, the problem was that the click-handling function was not marked as a UFUNCTION().

To fix it, all you need to do is add the UFUNCTION() macro just before you declare the function in your class (inside the *.h file). For example:

public:
    // ...
    UFUNCTION()
    void OnSelected();