Area3D does not see newly instanced StaticBody3D with Monitoring/Monitorable enabled
Godot version
4.0.beta1
System information
Windows 10
Issue description
I'm aware of #17238 (specific to Monitorable being enabled, which doesn't help here) and #57539 which is specific to moving a StaticBody. Could be the same fix works for this and #57539 but I did not want to miss this use-case.
When you have a Area3D and a new StaticBody3D is placed in the scene, it will not detect it until you change the collision_layer or collision_mask. I imagine other "touches" will force an update as well.
Steps to reproduce
- Create a scene with an Area3D.
- After scene is ready, add a StaticBody3D with the layer of the Area3D's mask.
Optional workaround: 3. After more time, update the collision_layer or collision_mask.
Minimal reproduction project
This MRP automates showing the bug and the current workaround.
I'm having this exact same bug in 2D. I'm using Godot version 4.0.beta4, on Windows 11.
Same issue with Area2D and StaticBody2D, Godot 4.0.2.stable, MacOS.
Area2D doesn't emit mouse_entered event as well if instantiated from script.
Linux v4.0.3.stable.mono.official
Same issue with v4.1.1.stable.official [bd6af8e0e], Linux
Same with Area2d, 4.2.stable, windows 11