+1 vote

whenever i connect a signal in code the debugger alwaays show
The function 'connect()' returns a value, but this value is never used
is there any way to fix it out

in Engine by (884 points)

1 Answer

+1 vote
Best answer

This is a warning. Your code still works. You can configure accordingly.

https://docs.godotengine.org/en/stable/getting_started/scripting/gdscript/warning_system.html

by (719 points)
selected by

Thank you
But is there any way to fix it

Check for the error. May save you some headache debugging down the line. E.g.

var err=turn_control.connect("turn_changed",self,"turn_changed")
if err:
    print("Error", err)

but if you don't care then do something like this by adding an underscore

var _err=turn_control.connect("turn_changed",self,"turn_changed")

There is a 3rd way but only works one variable at a time:

#warning-ignore:UNUSED_VARIABLE
var err=turn_control.connect("turn_changed",self,"turn_changed")

Thanks a lot

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.