Trigger event in IModuleInterface when editor selection changed

Not sure if this has been asked, but I couldn’t find anything.

I’m trying to create my own little editor plugin to help out our team with positioning objects, which involves moving the pivot on an actor to a more convenient location. I’ve got the functionality working, but it currently requires pressing a button every time you want to move the pivot. Ideally, it would happen automatically when you selected an actor.

Does anyone know how to trigger an event from an IModuleInterface, which is what my plugin extends, when selection in the editor changes?

Alternatively, is there a way to implement a Tick event in IModuleInterface, or do I need to add another class that can do it.

(I’ve seen how Rama did it in his plugin, but he’s extending the entire EditorEngine class, which is a lot more than I’d really like to do.)

Sounds like you need to hook into the USelection::SelectionChangedEvent and/or USelection::SelectObjectEvent delegates. These are multicast delegates that are fired when the selection in a level is changed.

SSceneOutliner provides an example of using these (SSceneOutliner::OnLevelSelectionChanged is the function called by the events).

Awesome, I thought there might be something, thanks for that :slight_smile: