Godot Version
godot-4
extends Node3D
@onready var nodes = get_node("../pathNodes")
@onready var sceneRoot = get_node("..")
var nodeArray = []
var idx = 0
func _ready():
if nodes.get_child_count() > 0:
nodeArray = []
idx = 0
for child in nodes.get_children():
if child.pathID == idx:
nodeArray.append(child)
else:
connectNodes(nodeArray)
idx += 1
nodeArray = []
connectNodes(nodeArray)
idx = 0
nodeArray = []
func connectNodes(NA):
var newPath = Path3D
add_child(newPath)
for node in NA:
newPath.Curve.add_point(node.get_global_position()) ```
#When I try to add_child(newPath), I get an error stating:
#Invalid type in function 'add_child' in base 'Node3D (node_connector.gd)'. The Object-derived class of argument 1 (Path3D) is not a subclass of the expected argument class.
#I've never encountered this error with add_child before, what am I doing wrong?