+1 vote

So if your confused with the title. Basically lets say I have a script called A.gd and B.gd. How can I change a variable in B.gd using A.gd? This is vital part of my hitscan weapon system I just want to know.

in Engine by (64 points)

1 Answer

0 votes
Best answer

Scripts are just files sitting in the project folder. They don't do anything on their own. They either define custom objects or are attached to nodes. The latter is far more common, so what you really have is node A and node B.

Nodes live in the scene tree. To communicate between nodes, you either use signals or get_node(). To be more specific, you'd need to describe your actual setup.

by (21,529 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 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.