Haven’t found a way to get an event for single actor/object, buy you can bind an event to get notified by any selection, then check if its this actor/object.
AMyActor::AMyActor()
{
#if WITH_EDITORONLY_DATA
USelection::SelectObjectEvent.AddUObject(this, &AMyActor::OnObjectSelected);
#endif
}
#if WITH_EDITORONLY_DATA
void AMyActor::OnObjectSelected(UObject* Object)
{
if (Object == this)
{
// DO STUFF
}
else if (!IsSelected())
{
// UNDO STUFF
}
}
#endif