0 votes

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
Godot version 3.2.3.stable
in Engine by (91 points)

1 Answer

+1 vote
Best answer

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
by (3,070 points)
selected by
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 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 webmaster@godotengine.org with your username.