Optimizing the Enemy with the VisibilityEnabler2D

Note that while in the video, we manually resize the VisibilityEnabler2D's bounds in the Inspector, by setting its Rect property, you can also scale it in the viewport using the Select Mode (Q).

Also, after you added the VisibilityEnabler2D node, you do not need the call to set_physics_process() in the script's _ready() function anymore.

There used to be a bug that required this line, but it's fixed in the latest Godot releases.

Community Discussion