Area3D Monitoring status not updating via code

Godot Version

4.3

Question

I have an Area3D setup to signal to the scene root when entered, incrementing a value and doing some other stuff. When the signal hits my function triggerOne(), it sets trigger_one (the Area3D)'s monitoring status to false. However, the actual status does not update, as shown in the game with the value repeatedly incrementing every time the player hits the Area3D and the status printed out in the console still reading as true. This is only a problem when the modification of the monitoring value is called on the Area3D where the signal is coming from, as shown in the screenshots. See screenshots, any help is greatly appreciated. Pretty convinced this is a bug unless there’s something really obvious I’m missing.

Scene Tree

Code

Console output

I recommend you take a look on the debugger, probably you’ll see a message like this one:

Also, after use Area3D.set_deferred("monitoring", false), you should await a idle frame with await get_tree().process_frame if you want to print the correct result because deferred call/set only happen on idle frame. NEVER change physics properties or delete physics objects outside the idle frame, otherwise this can lead to unexpected behavior or even a crash.

1 Like