Scene added via editor not instancing

Godot Version

4.5

Question

I feel a little bit insane here.

I have a scene, CustomTooltip, that I’ve instanced within another scene via the editor.


However, when I try to run that Line2D scene, it errors at CustomTooltip’s _ready() with an error that implies the entire scene wasn’t instanced.
image

This is the full tooltip script, for reference:

extends PanelContainer
class_name CustomTooltip

func _ready() -> void:
	%Timer.timeout.connect(_display)

func _process(_delta: float) -> void:
	if visible:
		global_position = get_global_mouse_position()
		global_position.y += 5

## Starts timer till tooltip is made visible
func display_tooltip() -> void:
	%Timer.start()

## Triggered by timer timeout, makes tooltip visible and updates position
func _display() -> void:
	_update_position()
	visible = true

## Updates global_position to the global_mouse_position + a small y offset
func _update_position() -> void:
	global_position = get_global_mouse_position()
	global_position.y += 5	

func hide_tooltip() -> void:
	if !%Timer.is_stopped():
		%Timer.stop()
	
	visible = false

func change_text(new_text: String) -> void:
	%Label.text = new_text

I’m at a bit of a loss here. I’ve instanced other scenes before via the editor with no issues, so I must be missing something? I’m not sure what I’m doing differently here that’s breaking it. Is there something in the tooltip script that’s causing problems?

I think it is because you are referencing %Timer directly. Try referring to the control with a variable.

@onready var timer: Timer = %Timer

timer.start()

I was actually doing that originally. I tried it with @onready, I tried with it as an @export that I assign in the editor, now I’ve got it as a unique name. But all of them have the same error.

Holy cow, alright, nevermind yall I figured it out. I was looking in the wrong place for the problem, there was a different scene that somehow ended up with just the CustomTooltip parent node attached instead of the entire CustomTooltip scene, so it was freaking out -_-