Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | equus |
Hello! I’m getting an error and I have no idea why. I don’t remember what parts of code I changed and the error trace doesn’t show any information to me. Nevertheless I can run the code but sometimes it crashes randomly. The editor keeps working.
I don’t know what parts of code I must post here so I will only post the error.
Godot version: 2.1.4
The error is: Condition ’ ResourceCache::resources.has(p_path) ’ is true.
I commented this part of code and the error was not showing anymore:
func _on_life_create_enemy_common():
var player = get_node("/root/Node/PlayerRoot/KB2D")
var player_pos = player.get_global_pos()
print(str(player_pos))
var new_pos = player_pos
new_pos.y -= 100
var new_enemy = preload("res://scenes/3_3/enemy_common.tscn")
new_enemy = new_enemy.instance()
var the_root = get_node("/root/Node")
the_root.add_child(new_enemy)
new_enemy.set_global_pos(new_pos)
parent.queue_free()
What could cause the error above?
But the player keeps crashing. I will look to my code again.
equus | 2018-03-12 21:20
I found the reason why godot crashes. It was not a crash. I was freeing the node that owns all the other nodes. But I still thinking what caused the ResourceCache error.
equus | 2018-03-13 00:06