Error while hiding a Control Node

Hello, I’m making the Interaction System of my game in Godot 4 and I’m making that the Interact UI hides when the raycast is not hovering on the interactable object, but it gives me this error: E 0:00:00:0482 interact_ray.gd:14 @ _process(): Node not found: “Player_UI” (relative to “/root/Mundo/Player/Head/Camera3D/InteractRay”).
<C++ Error> Method/function failed. Returning: nullptr
<C++ Source> scene/main/node.cpp:1651 @ get_node()
interact_ray.gd:14 @ _process()

This is the code:

image

The $ symbol gets nodes from the current script’s node. You may have entered the wrong path, which is why $Player_UI is null. Drag and drop the Player_UI node from the editor to the code editor to fix the path.

I did it, and It’s the same, it give’s me the same error.
(I changed the name)
image

If you could take a screenshot of the structure of your scene, that would be great.

image

As I said, the pathname is wrong. In your scene, only the Mundo node has access to interactUI via “$interactUI”.

I don’t see RayCast3D in the screenshot, is he under Player?
If so, then the path would be something like $“…/…/interactUI”.

You can drag and drop the node from the editor directly into the code to make sure the path is correct.

Godot_v4.2.2-stable_win64_yyIvp8yqLW

Ok, I’m going to explain, the player is in another scene, and the interactUI the same, so… I have to put the interact UI as a children of the interact ray or something?

Not that it has to be there. Because $interactUI is essentially self.get_node(“. /interactUI”), if you want to use $interactUI, interactUI must be a child of the script node.