Browse Source

:beetle: Fix unhappy Godot collecting chocolate

Fix this exact error :

chocolate.gd:24 @ _give_chocolate_to(): Removing a CollisionObject node during a physics callback is not allowed and will cause undesired behavior. Remove with call_deferred() instead.
DricomDragon 1 week ago
parent
commit
82868253a6
1 changed files with 1 additions and 1 deletions
  1. 1 1
      godot/component/entity/collectibles/chocolate/chocolate.gd

+ 1 - 1
godot/component/entity/collectibles/chocolate/chocolate.gd

@@ -21,7 +21,7 @@ func _on_chocolate_tablet_body_entered(body: Node3D) -> void:
 
 func _give_chocolate_to(walker: Walker) -> void:
 	walker.give_chocolate()
-	reparent(walker)
+	reparent.call_deferred(walker)
 	chocolateAnimation.play(COLLECT_ANIM)
 	chocolateAnimation.animation_finished.connect(_finish)
 	pickupSound.play()