Instantiated object not visible

Godot Version

`4.3

Question

I have this function that instantiates an object and assigns its value based on a resource:

image_2024-11-22_214508866

When I press the deal cards button, it adds the object to the scene tree and assigns the correct properties, but the object is not visible in game. This is what my scene tree looks like:
image_2024-11-22_215146630

It’s adding the card and reparenting it correctly and assigning the proper values according to the inspector and the print statements, but it’s just not showing up in the game. I’ve tried changing the z index and toggling z as relative and all that and it’s just not showing up. I’m kind of at a loss.

what about the card_temp position? is it 0,0?

yes, it’s 0,0.

the hand node is Full rect layout? or can you confirm it’s inside viewable screen

This is my project window. I added a color rect to the hand object to show where it’s located. It’s not usually there.

if your hand Control panel is still using position for the layout, then you will want to change it to Anchor and set it to Full Rect first

I found a workaround that I think will work. Before, my
card_temp object was a node2D. I changed it to a button (the cards are going to need to be clickable anyway) and it worked. They show up in the game window and are clickable. I’m not used to working with control nodes and I don’t quite understand anchors and layouts so I’ll have to read up on that, but I did at least get something that works now. Thanks for your help (and your patience!)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.