The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

I'm making a FNaF styled-game in Godot. I have the New Game button on the main menu which is a TextureButton. It changes animation when hovered, but how do I make it so that it switches scenes on clicking the button? Thanks.

in Engine by (22 points)

1 Answer

+2 votes
Best answer

Buttons and TextureButtons emit the pressed() signal when they are pressed. For a brief overview of signals, see the documentation.

You want to link this signal to some change scene code so that when the button is pressed, the change scene code is executed.

To do this, click on your Button node, then select the Node tab beside the Inspector tab. Then select the pressed() signal. This will open a window to select which node you want to connect the signal to. Select whatever main node is running the main script of your scene.

For example,

enter image description here
enter image description here

Then you can write whatever change scene code you want to be executed.

For example,

by (1,600 points)
selected by

Thanks, You are the best!

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 Frequently asked questions and 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 [email protected] with your username.