How to change the "far object"'s variables?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Krasapan

I need to change the value of the variable radial_menu which is in Stage1/PlayerScene from Stage1/HUD/playerHudScene. How to do that?

SceneTree:

┖╴Stage1
  ┠╴PlayerScene
  ┖╴HUD
    ┖╴playerHudScene
:bust_in_silhouette: Reply From: Wakatta

It’s frequently debated which is the correct approach but I’ll let you choose whichever you find most appropriate.

  1. get_parent().get_parent().get_node("PlayerScene").radial_menu
  2. find_parent("Stage1").get_node("PlayerScene").radial_menu
  3. get_node("/root/Stage1/PlayerScene".radial_menu
  4. get_tree().get_current_scene().get_child(1).radial_menu