Topic was automatically imported from the old Question2Answer platform.
Asked By
NaughtyGnosiophile
The full error:
0:00:04:0248 - Node ‘./Crosshairs’ was modified from inside an instance, but it has vanished.
Type:Warning
Description:
Time: 0:00:04:0248
C Error: Node ‘./Crosshairs’ was modified from inside an instance, but it has vanished.
C Source: scene/resources/packed_scene.cpp:149
C Function: instance
I have a weapon class that contains an exported packed scene Crosshairs.
extends Node2D
export(PackedScene) var crosshairs
var _crosshairs
func _ready():
_crosshairs = crosshairs.instance()
In another class, when this weapon class is instantiated, I get the warning.
extends Panel
export(PackedScene) var weapon
var _weapon
func _ready():
if weapon == null:
return
_weapon = weapon.instance()
The error happens on the line _weapon = weapon.instance()
So what does this error mean? Should I be concerned? (I hate errors.) How can I fix it?
Now this error occurred when I right-clicked CollisionPolygon2D in the child, selected “Change Type” and made it CollisionShape2D. This appears to work in the editor, however if you check the remote inspector while running you’ll see it is using the parent’s original node (CollisionPolygon2D here).
The only way I could find to fix it is to delete and re-create the child scene.
I had the same problem. I looked in the scenes tscn-file with the editor. Looks like it saved the file wrong.
I open the file in the editor, and right-click the tab → save-file so overwrite the tscn file again.
Then it was working.
Hope this work for you all, too!
Thanks for the tip. I was getting this error when I deleted nodes from the parent node and had made modifications to those nodes in the children. So I had to go into each child tscn file and remove the reference to the deleted node.