How to emit screen related signals of VisibilityNotifier2D if the gameplay screen isn't part of the root viewport

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By OdTogerus

I have this scene where the node hierarchy made it so that the default root viewport isn’t where the main gameplay occurs and instead happens inside another viewport to make space in the screen. Visual Representation

Now I want to emit a signal from VisibilityNotifier2D each time the node enters/exit the gameplay viewport/screen, but VisibilityNotifier2D doesn’t emit a signal.

What I have in my game:
The gameplay viewport is scrolled via the player’s camera and I want it so that each time an enemy enters/exit the gameplay screen, their VisibilityNotifier2D would a send signal to its parent node to start/stop the parent’s despawn process.

:bust_in_silhouette: Reply From: OdTogerus

I made the parent of the VisibilityNotifier2D a Node instead of Node2D which means that the VisbilityNotifier2D’s “Detection Rectangle” didn’t move at all and stayed at 0,0. This meant that what you see in-game is not reflecting what’s actually happening behind the scenes.

Also to answer the question. The “Screen” is the entire window the game is playing on. You will need to specify the viewport if you’re using the same setup as I have where the meat of the game is in another viewport to make space for UI/HUD elements on the side of the screen.