#Error without reason: get_node_or_null: Can't use get_node() with absolute paths from outside active

7 messages · Page 1 of 1 (latest)

hot quarry
#

Hello, I hope someone can help me to tell me what is wrong with this piece of code:

    node.add_child(p1)
    p1.path_node = path.get_path()
    p1.mode = CSGPolygon3D.MODE_PATH```

This is the error message I get and I tried a lot:
E 0:00:01:0378   get_node_or_null: Can't use get_node() with absolute paths from outside the active scene tree.
  <C++ Error>    Condition "!data.inside_tree && p_path.is_absolute()" is true. Returning: nullptr
  <C++ Source>   scene/main/node.cpp:1575 @ get_node_or_null()

The error specifically occurs due to this line "p1.path_node = path.get_path()"
when I print(path.get_path()) the error doesn't happen. 
When I replace the path with "..", the error does happen.
When I replace the path with "asdfhjhke", the error does not happen.

Is this a godot 4 issue maybe? I would be glad to get any help.
hot quarry
#

just above. It's also create with .new() and immediately added add_child(path) to a parent node

hot quarry
solar cliff
hot quarry
#

var node = Node.new()
node.name = "MeshNode"
var path = Path3D.new()
var polygon = load("res://Scenes/RailProfile.tscn").instantiate() # == railProfile
add_child(node)
node.add_child(path)
path.add_child(polygon)

var curve: Curve3D = Curve3D.new()
# FIXME sometime
for i in range(0, floor(railLength/stepsize)):
    curve.add_point(getPosition(i * stepsize))
if floor(railLength/stepsize) != railLength/stepsize:
    curve.add_point(getPosition(railLength))
path.curve = curve