This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

i make test tree like:
Test
...|Slot (slotScript)
............|
area2d (listen areaentered)
............|
tempitem
...|
Item(itemScript)
............|itemarea_2d

function
func _on_item_slot_area_entered(area):
only give object : "itemarea2d" but i need "Item" object to assign temp_item = Item
how can i do it ?

Godot version 3.4.3
in Engine by (32 points)
func _on_item_slot_area_entered(area):
        print(area.get_parent().get_node("Item"))
        or 
        print(area.get_parent().get_parent().get_node("Item"))

ty for your answer. May be example above too simple to discription my situation.

im try drag "item" to "item_slot" (both have area2d) by 2 signal
1 item enter slot area
2 mouse is release

but "itemarea" deep is different among others item and "item" name different too so i cant call multi times get_parent() because i dont know how deep "itemarea" are.

each item are scene it self

i'm looking for solution help me determine which "itemarea" parent without call getparent or must know node name. Example above node "Item" is what i want

  • other small problem: how make text indent by tab in comment ?

1 Answer

0 votes
Best answer

i solve my problem by my self after few test (actually after many digging ).

area.owner extractly what i looking for

ty

by (32 points)
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.