0 votes

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! :)

asked Mar 8 in Engine by Nothing (56 points)

1 Answer

0 votes
Best answer

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.

https://docs.godotengine.org/en/stable/getting_started/step_by_step/signals.html

answered Mar 8 by jgodfrey (5,246 points)
selected Jun 15 by Nothing
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.