0 votes

I want to know if there are a way to acess other nodes and their things easily because I am very dependent of auto-completion and when I want to acess, it doesn't appears. For example:

I have a node called cow and another called bird (cow is child of main and bird is child of tree that is child of main).


extends Node2D

var _life = 100

func _ready():
    # I need to do something?


extends Node2D

var _test = "something"

func _ready():
    # Something

Now if I want to acess one from the other and its vars and functions. What I need to do?

in Engine by (692 points)

You can access vars with get_node("NodePathHere").VarNameHere pretty easily, but I don't know about functions.

1 Answer

+2 votes
Best answer

Is it okay for you to export a variable from one script and attach the required node through inspector?

export (NodePath) var cow

by (71 points)
selected by

This works, but what about nodes instantiated by gdscript?

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.