area clear monitoring

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By alvin00221
:warning: Old Version Published before Godot 3 was released.

Guys what does it error means?
My game is fine and still running but this error showing up. This is happening in this line of code:

func _on_EnemyArea_body_exit( body ):
	#print(body.get_name())
	if(body.get_name().begins_with("Enemy")):
		#arrenem.erase(body.get_name())
		arrenem.erase(body.get_name())

This is the error:

DETECTED MONITORS: 1
ERROR: Area::_clear_monitoring: Condition ’ !node ’ is true. Continuing…:
At: scene\3d\area.cpp:247
ERROR: Area::_clear_monitoring: Condition ’ !node ’ is true. Continuing…:
At: scene\3d\area.cpp:247
ERROR: Area::_clear_monitoring: Condition ’ !node ’ is true. Continuing…:
At: scene\3d\area.cpp:247
ERROR: Area::_clear_monitoring: Condition ’ !node ’ is true. Continuing…:
At: scene\3d\area.cpp:247
ERROR: Area::_clear_monitoring: Condition ’ !node ’ is true. Continuing…:
At: scene\3d\area.cpp:247
ERROR: Area::_clear_monitoring: Condition ’ !node ’ is true. Continuing…:
At: scene\3d\area.cpp:247
ERROR: Area::_clear_monitoring: Condition ’ !node ’ is true. Continuing…:
At: scene\3d\area.cpp:247
ERROR: Area::_clear_monitoring: Condition ’ !node ’ is true. Continuing…:
At: scene\3d\area.cpp:247
ERROR: Area::_clear_monitoring: Condition ’ !node ’ is true. Continuing…:
At: scene\3d\area.cpp:247

Does it happen when your Area2D exits SceneTree (it or any of its parents got freed / removed from parent)?

Kermer | 2016-06-11 00:12

Because, if I get this right it looks something like this:

  1. NOTIFICATION_EXIT_TREE or “monitoring” changes to false
  2. Area loops through all object that are mapped to be inside it, to call body_exit and body_exit_shape signals
  3. If the object already have been deleted/freed this error is displayed

Kermer | 2016-06-11 00:19

This is for 3d Game.

Actually I have Area3d and the enemy was freed. so what i basically did I used area exit.

  1. so my next question is how can i change my variable if enemy deleted/freed?
  2. How can i use body_exit without having error?

alvin00221 | 2016-06-11 01:17

Yes! SceneTree was freed or removed

alvin00221 | 2016-06-11 02:21

Ok I got it… I shouldn’t freed/destroy my body.object inside the area_exit() method. I will change my algorithm. Thank you very much! :slight_smile:

alvin00221 | 2016-06-11 02:41

:bust_in_silhouette: Reply From: alvin00221

Because, if I get this right it looks something like this:

1.NOTIFICATION_EXIT_TREE or "monitoring" changes to false
2. Area loops through all object that are mapped to be inside it, to call body_exit and body_exit_shape signals
3. If the object already have been deleted/freed this error is displayed

Ok I got it… I shouldn’t freed/destroy my body.object inside the area_exit() method. I will change my algorithm. Thank you very much! :slight_smile:

If you want to delete the body inside of body_exit and body.queue_free() still produces this error, you can try to do body.call_deferred("queue_free") which should call it next frame instead.

Kermer | 2016-06-11 11:01

Hi Kermer thanks for your effort to answering my question.

Btw call_deffered() is not also working. Because my object is still inside the area.

The error will always display as long as the object inside that area was freed… so meaning what best thing to do is destroy the object without giving signal to area.

this is very sad :frowning:

alvin00221 | 2016-06-12 01:43