Is object B getting collisions other than object A? If it is, make sure the script knows that the area_3d.get_parent() has to be object A for it to try and get the power variable.
it has an area and a collision shape. Both set to “powersource” group.
obj B has an area with collision shape as well. The area scales up and covers the area of obj A every 5 seconds. (this works! since obj B can print the .name of the parent of obj A)
obj B looks like this:
extends Node3D
@export var power : float = 0.0
func _on_area_3d_area_entered(area: Area3D) -> void:
if area.is_in_group("PowerSource"):
print(area.get_parent().name)
power = area.get_parent().power <----------------------------FAILS! :worried:
func _process(delta: float) -> void:
#doing the things that i dont need to write here, since it works.
Adding a timer may not be sufficient to allow a child node to complete.
You might be able to test If that is the issue by print(get_parent().is_node_ready())
If it isn’t the issue then it could only be that despite printing the correct name the node being garnered by get_parent() is not the one you want.
Double check the remote tab while the game is running to see your scene structure.
I did some testing on this and area.get_parent().my_variable works fine on all of my tests. Removing my answer, but I think you have a referencing problem. ie power is not defined in your parent, or your parent is not what you think it is.
I thought maybe get_parent was not providing a way to access keys, only properties, but this is not the case.