0 votes

I'm running Godot v 3.1.1. I've done some tutorials with v 2.x in the past, but just installed v 3.1.1 and already hitting a roadblock on something that should be pretty easy.

What I'm doing is pretty simple - just trying to connect the "pressed" signal to my Panel control object, but I get the error, "Target method not found! Specify a valid method or attach a script to target node".

Thoughts?

Script:

extends Panel

var money = 0

func _ready():
$MoneyLabel.text = "$" + str(money)

Screenshots:

Connect Signal dialog
Connect Signal error

asked Sep 5, 2019 in Engine by carbon3c (12 points)

I noticed in the scene panel, none of the objects had a script icon attached to it. That's strange, because the script clearly shows that it "extends Panel". I'm not sure what happened. I restarted the project from scratch and this time the script icon appears next to the Panel object, and now the Connect Signal works without error. I have no idea what I did differently, but it's now working.

Scene Panel script icon - working

Creating a script and attaching it to a scene tree are two different steps. Just naming it Panel.gd and extending Panel does not attach it to the scene tree. Two possible explanations:
(1) You just copied the script from somewhere to your resources folder but did not assign it to the Panel node.
(2) It was previously assigned to the Panel node, but you (accidentally) removed the assignment (it's just one click, you don't even need to confirm anything)
In both cases it's easy to (re-)assign it to the node by selecting "add script" and just choosing the existing script.

2 Answers

0 votes

Hey there,

I have found that once you have added a new script to the specific node (parent or child node), you can go back to the signals to connect it to the node.

answered Jan 15 by jamilimages (14 points)
0 votes

in Godot 3.0 you can attach signal to built in functions for example "queue_free"
Godot 3.0

but Godot 3.2 doesn't allows you to do that
enter image description here

answered Jul 13 by Meow (18 points)
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.