_on_visible_on_screen_notifier_2d_screen_exited()

Godot Version

4.5.1

Question

I've updated a project from last year to Godot 4.5 and now I'm getting a few errors specifically with regards to _on_visible_on_screen_notifier_2d_screen_exited() for sprites leaving the screen

func _on_visible_on_screen_notifier_2d_screen_exited():
# Out of sight, out of memory
queue_free()

I get the error:

E 0:00:07:538 emit_signalp: Error calling from signal ‘screen_exited’ to callable: ‘Area2D(enemy_c.gd)::_on_visible_on_screen_notifier_2d_screen_exited’: Method expected 0 argument(s), but called with 1.
<C++ Source> core/object/object.cpp:1310 @ emit_signalp()

Since I’m not calling it with any parameters I’m just confused.

I’d say try to completely remove that function and delete the signal, then try to re-connect it.

2 Likes

Thank you!

That was it! The new function has changed ever so slightly:

func _on_visible_on_screen_notifier_2d_screen_exited() → void: