Can't set an Area2D scene monitorable property as false via script

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

I’m trying to set the monitorable property of the instanced Area2D scene as false via script after the other Area2D enters it, but it’s not working, it’s always says it is true. The rest of the code works as expected.

What am I doing wrong here ?

I’ve tried:

self.monitorable = false


:bust_in_silhouette: Reply From: Bypell

maybe try to use


otherwise I do not know what’s wrong

Edit: Zylann’s answer is better. Idk what is wrong with me, set_deferred is way better

:bust_in_silhouette: Reply From: Zylann

I tried this too printing the monitorable property every frame, and you can actually see what’s happening in the system console:

ERROR: Function blocked during in/out signal. Use set_deferred("monitorable", true/false).
   At: scene/2d/area_2d.cpp:424

It’s a bit unintuitive, but the reason monitorable cannot be changed from within the signal handler is because the area is currently doing the monitoring, that state cannot be changed until it’s done doing it.
So you may want to do this instead:

set_deferred("monitorable", false) 

Thanks a lot, man!

arthurZ | 2020-03-09 12:53


Wow, thank you so much! I just spend 1 hr trying to figure this out, this helps so much.

1 Like