在我的2D游戏中,玩家有能力摧毁装有两种碰撞形状的箱子。当销毁箱子时,会生成一些也带有碰撞形状的物品。但是当调用下面的函数时,Godot控制台中会显示许多类似的错误信息。
代码:
错误:
代码:
func _on_Crate_item_dropped(collectible, pos):
collectible.init(pos, Vector2(rand_range(30, 100), rand_range(-10, 10)))
$CollectibleContainer.add_child(collectible) # error occurs here
错误:
ERROR: Can't change this state while flushing queries. Use call_deferred() or set_deferred() to change monitoring state instead.