- Edited
I tried to attach a gdscript code to a child node during the runtime. But no effect of the script on run. Need help!!!
Thanks in advance.
Codes are below.
(attached script to the "parent" Node2D)
extends Node2D
func _ready():
$Line2D.set_script(load("res://drawing_line.gd"))
(drawing_line.gd - gdscript which I tried to attach to the child node)
extends Line2D
var line2D_coord_X1 = 697.1718063
var line2D_coord_Y1 = 157.0043504
var line2D_coord_X2 = 224.4594551
var line2D_coord_Y2 = -55.62737387
func _ready():
self.clear_points()
self.add_point(Vector2(line2D_coord_X1, line2D_coord_Y1))
self.add_point(Vector2(line2D_coord_X2, line2D_coord_Y2))