Activate the button from the viewport

Hey, I have a question how to activate the button from the viewport?

uh can u please elaborate your question?

I have a button to turn the light on and off, I would like to run it in viewport. Not in the game.

I would like to run it in viewport.
Not in the game.

Viewport = game window, hence the confusion.


Do you want to control something out of PIE (play in editor). Perhaps you’re looking for Blutilities a.k.a. Blueprint Utilities:

A Blueprint Utility, a.k.a. a Blutility, is an
editor-only Blueprint that can be used
to perform editor actions or extend
editor functionality. These can expose
Events with no parameters as buttons
in the UI and have the ability to
execute any functions exposed to
Blueprints and act on the current set
of selected Actors in the viewport.

to create a event that can be called in the editor you simply need to have a custom event for the script you want to run, then select the event and in the details panel check the box which says call in editor. this will make it so when the actor is selected in the viewport you will have a button in the details panel to run the event.