0 votes

I am new to GDScript and a bit newbie type in programming.....I am Trying to implement button connect signal action inside user-defined class....but its not working.....is there any other way to implement the button pressed action or any other way out

Here is simplified version of the code I am using

 
extends Node class example :
var a=2
var b=6
var c
var button func add_button(handle,text:String) : Button_click() # working button=Button.new() button.text=text button.connect("pressed",self,"Button_click") # Not working handle.add_child(button) func Button_click(): c=a+b print("C="+str(c)) func _ready(): var My_Class=example.new() My_Class.add_button(self,"Click to see C")


Godot version 3.4.2
in Engine by (14 points)

Please log in or register to answer this question.

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.