So I have a problem with exporting the project

So I have a problem with exporting the project. when I export the project
it breaks down the error message is "
ERROR: Edit state is only for editors, does not work without tools compiled.
at: (scene/resources/packed_scene.cpp:2090)
ERROR: Parameter “p_child” is null.
at: add_child (scene/main/node.cpp:1566)"

The script that causes the problem is this and forgive me for the bad code in terms of parents and children.


var book = load("res://book.tscn")
var BookFly = load("res://bookfly.tscn")

var turn = 0
var dup
var a = 0
var b = 0
var c
var t = 0
var rng = 0

func _process(delta: float) -> void:
	if b == 0:
		rng = randi_range(1,2)
	if turn == 1:
		if rng == 1:
			if t > 10:
				b += 1
				a += 1
				c = self.get_parent().get_parent().get_child(0).position.x
				if b > 300:
					turn = 0
					self.get_parent().get_parent().get_child(0).turn = 0
					self.get_parent().get_parent().get_child(0).loc = 1
					self.get_parent().get_parent().get_child(5).text = "In my way"
					b = 0
				if a > 17:
					dup = book.instantiate(c);
					self.get_parent().add_child(dup,true);
					a = 0
			else:
				t +=1
		if rng == 2:
			if t > 10:
				b += 1
				a += 1
				c = self.get_parent().get_parent().get_child(0).position.x
				if b > 300:
					turn = 0
					self.get_parent().get_parent().get_child(0).turn = 0
					self.get_parent().get_parent().get_child(0).loc = 1
					self.get_parent().get_parent().get_child(5).text = "In my way"
					b = 0
				if a > 20 and b < 200:
					dup = BookFly.instantiate(c);
					self.get_parent().add_child(dup,true);
					a = 0

I tried to fix it by checking similar topic but it didn’t help.

PackedScene’s (such as your book and BookFly) instantiate takes a integer argument for bitmask flags, by using c aka self.get_parent().get_parent().get_child(0).position.x Godot converts this position into an integer value of which you have no idea what the flags are and end up including some editor-only flags.

Remove the c argument, what did you think it was doing? What do you want c to do?

dup = book.instantiate();

yeah I just forgot to remove it after rewriting a bit of code that used it

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.