the value is not changing

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

I’m trying to update the monitoring value of area2d when an area collides with it, but it’s not updating, if I put a separate variable or print(), it executes the function normally, only when I put self.monitoring it doesn’t work… .

func _process(delta):
    print(self.monitoring)
    function()

func _on_coin_area_entered(area):
    self.monitoring = false


console: 
true
true
player area entered
true
true
....

Is the expected behavior that the _on_coin_area_entered function stops being called after the coin enters the area, but the function is still being called even after the coin enters?

godot_dev_ | 2023-01-13 18:32

Silly question, but did you try putting a print(“coin area entered”) on the signal posted above? It looks like you’re printing that the player’s area detected entry successfully but we don’t know for sure that the coin’s area detected anything. I’m wondering if there’s some sort of collision layer stuff going on.

BillRogers | 2023-01-13 23:48

Silly question, but did you try putting a print(“coin area entered”) on the signal posted above? It looks like you’re printing that the player’s area detected entry successfully but we don’t know for sure that the coin’s area detected anything. I’m wondering if there’s some sort of collision layer stuff going on.

BillRogers | 2023-01-13 23:49