0 votes

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?

in Engine by (32 points)

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

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)

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

No because I have no clue how to use those.

2 Answers

0 votes
Best answer

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

by (32 points)
0 votes

Is txture a typo or intended?

by (191 points)

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

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.