0 votes

When the user clicks on a button, I want to write a script on C#. How can I write?

Godot version 3.3.2
in Engine by (64 points)

1 Answer

+1 vote

For this you need to use its pressed signal. Click on the button node in the scene dock panel.... In the inspector select node. By default signals would be selected. Then there double click on the pressed signal. if you want then change recievers method and finally click connect. But remember the node to which you are connecting signals must have a script.

This works in both c# and gdscript.
Docs: https://docs.godotengine.org/en/stable/getting_started/step_by_step/signals.html

by (884 points)
edited by
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.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.