Plugin react on the user selecting an actor

Hello UDN team,

how can I make my plugin react on the user selecting an actor (e.g by picking in the viewport or selecting in the world outliner)?

I know how to access the current selection using:

GEditor->GetSelectedActors()

but I need this as a delegate or virtual to be able to do things when the user picks an actor.

Thanks a bunch,
Stephan

Got it!

Your header:

class YourClass {
   ....
   UFUNCTION()
   void on_selection_changed(UObject *n_object);
}

In your impl:

GEditor->GetSelectedSet(AActor::StaticClass())->SelectObjectEvent.AddRaw(this, &YourClass::on_selection_changed);

Function will be called when user selects an actor.

Cheers and sorry for the noise…

Stephan