+5 votes

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?

in Engine by (35 points)

Also having this error...

2 Answers

+2 votes

I ended up having this error when I used "Change Type" on a child node of an inherited scene. I fixed it by deleting and re-creating the child.

For example

Parent:

KinematicBody2D
- CollisionPolygon2D

The child is created using "New Inherited Scene" and selecting the parent. So it's:

KinematicBody2D
- CollisionPolygon2D
- TimerNodeAddedToChild

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.

by (673 points)
0 votes

Sorry for bringing this up 1 years later.

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!

by (1,448 points)

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.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.