Game stops running during debugging

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

Before you tell me that the game is supposed to stop running during debugging, I know that already. This is different.

I have a script that handles the slots of an inventory. Most of the script works, except for a part of it. I started to debug it to figure out where it stops working, but I can’t exactly determine the problem because the engine decides to stop running the debug session.

Here’s the problematic part, breakpoints marked, problematic breakpoint also marked:

if event.button_index == BUTTON_RIGHT and event.pressed:
	var interactableScript = preload("res://scripts/interactable.gd")
	var item = Area2D.new()
	var itemSprite = Sprite.new()
	var itemClickBounds = CollisionShape2D.new()
	var boundsShape = RectangleShape2D.new()
			
	boundsShape.extents = Vector2(17, 17)
	itemClickBounds.shape = boundsShape
	
	itemSprite.texture = txture
	
	item.add_child(itemSprite)
	item.add_child(itemClickBounds)
	
	item.set_script(interactableScript)
	item.itemName = item                        #breakpoint here
	item.itemTexture = txture                   #PROBLEMATIC breakpoint
	item.usage = usage                          #breakpoint here
			
	GVars.currentSceneRoot.add_child(item)      #breakpoint here
	clear()

To be clear of what it’s supposed to do, it’s supposed to drop an item out of the inventory and onto the world (for now, at the origin point).

What keeps happening is whenever the debugger gets to the problematic breakpoint, the inspector blanks, meaning every tab except for the resource and the reference tabs disappear. Then it just… stops.

I’ve tried this multiple times, same issues, don’t know why it’s doing it. I’ve even removed the problematic breakpoint, only to find that the problematic breakpoint “moves” to the breakpoint next in line. The stopping issue only happens when I have breakpoints. If I’m skipping breakpoints, it doesn’t happen and keeps running through the execution of the script.

Any ideas why this is happening?

Is txture declared as a variable and can you tell us the error that the engine is giving out?

Sinowa-Programming | 2020-06-18 15:11

txture is declared as a variable at the top of the class, and is being set beforehand by another function. As far as an error goes, I can’t see any errors that are coming from the engine or the debugger. It just… stops. (And yes I have verified that txture is being set correctly)

Surge | 2020-06-18 15:39

Any setgets declared for txture? Engine may be stuck in an infinite setget call loop, not sure.

Mike Trevor | 2020-06-18 15:58

No because I have no clue how to use those.

Surge | 2020-06-18 16:47

:bust_in_silhouette: Reply From: Mike Trevor

Is txture a typo or intended?

It was intended. The name texture is already taken by the superclass

Surge | 2020-06-18 14:44

:bust_in_silhouette: Reply From: Surge

Ok I found the solution to all of my problems. It was to use the call_group function instead of using signals.