I'm trying to get the value of a variable in the parent node of the current node using get_parent().get_parent().CardSize
when I print this value it works fine, returning the Vector. But the Debugger throws the following error: Invalid get index 'CardSize' (on base: 'MarginContainer (card_base.gd)'). See screenshots for output. I'm confused as to what's causing this and would appreciate help!


  • xyz replied to this.

    wizwon Looks like you didn't fetch the right node. Hard to tell exactly without seeing your node tree.

      xyz But if it wasn't the right node, how is the print printing the correct value? Here's the tree from debugger. The code is in card_base.gd

      • xyz replied to this.

        wizwon The code is in card_base.gd

        Yeah, but where is card_base.gd in the scene tree?

          xyz It's attached to CardBase (parent node Cards, the other margin containers in Cards are instances of CardBase)

          • xyz replied to this.

            wizwon Post the whole expanded tree and mark the node with the script and the node it wants to access.