Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | elrico26 |
I get remove_child: Cannot remover child node of this node
but I previously added it with add_child using a variable instance, because it tells me that this node does not exist, can someone help me?
Instead of asking different variations of the same question over and over, why not just use the Comment feature provided within a question to continue the conversation in a single place? It’s very confusing for people trying to help you or people seeking the same information in the future when the info is scattered between multiple questions.
Back to your question…
To get help, you’re going to need to:
- Post the offending code (using the Code Sample
{ }
button) - Indicate what line is causing the error
- Post (either as text or a screenshot) the organization of your scene tree
- Post the exact error message you see in Godot
jgodfrey | 2020-10-21 14:08
ok sorry look
onready var iteam_ma = load("res://Scrips materiales/Madera.tscn")
func _process(delta):
var madera1 = iteam_ma.instance()
if madera == true && ocupado1_ma == false && ocupado_universal1 == false && ocupado2_ma == false:
$slot1.add_child(_slot1)
$item_slot1_ma.add_child(madera1)
ocupado1_ma= true
ocupado_universal1 = true
["that's how I add the node"]
if Input.is_action_pressed("Shif"):
$item_slot1_ma.remove_child(madera1)
[“and that’s how I want to eliminate”]
and the error is
E 0:00:16.417 remove_child: Cannot remove child node Madera as it is not a child of this node.
` <Error de C++>Condition “idx == -1” is true.
<Fuente C++> scene/main/node.cpp:1256 @ remove_child()
Inventario.gd:58 @ _process()
elrico26 | 2020-10-22 00:01