Button press detection?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Nothing

Hi! I’m trying to make a stock market simulator but I want to know the best way to detect the UI button being pressed. So I can call my update function to update stock prices and the newsfeed in the game. Thanks! :slight_smile:

1 Like
:bust_in_silhouette: Reply From: jgodfrey

You’ll want to just connect its pressed signal to a signal handler function. The function will be called each time the button is pressed. There, you can add code to do whatever you need.

You can connect up the signal in the editor, via the Signals panel, or in code via connect method.

1 Like