Scene works when alone but not in a different scnene

Godot Version

4.4

Question

I'm trying to code a fridge scene for my game, and the fridge scene works as it should independently, but when I attempt to drag it into a different scene it doesn’t do anything. I have no clue why it isn’t working, so any help is appreciated

extends Node2D

@export var spawn_object = preload("res://Scenes/dragtest.tscn")
@onready var open_area = $"FridgeRECT/Fridge OPEN AREA"
@onready var close_area =$"FridgeRECT/Fridge CLOSE AREA"

var OPEN = false

func _ready():
	var OPEN = false
	pass

func spawn():
	var obj = spawn_object.instantiate()
	obj.position = Vector2(450,100)
	add_sibling(obj)

func _on_fridge_open_area_input_event(viewport: Node, event: InputEvent, shape_idx: int) -> void:
	if Input.is_action_just_pressed("leftclick"):
		if OPEN == false:
			OPEN = true
			# $Kitchen.play("Fridge Open")
			print("its open")
			spawn()
	if OPEN == true:
		open_area.visible = false
		close_area.visible = true
		
func _on_fridge_close_area_input_event(viewport: Node, event: InputEvent, shape_idx: int) -> void:
	if Input.is_action_just_pressed("leftclick"):
		OPEN = false
		# $Kitchen.play("Fridge Close")
	if OPEN == false:
		open_area.visible = true
		print("door closed")
		close_area.visible = false

The fridge scene:

Scene I added the fridge to:

What’s the tooltip say when you hover over the yellow warning triangle next to the Cook Node2D?

image

Ok, well do what it says or you’re going to have problems down the line. See if that solves it. Probably won’t.

But please describe what “doesn’t work” means. What’s it look like when it works. What’s it look like when it’s broken?

ok that worked, should have probably done that to begin with…. thank you!

1 Like