Update: Godot's Visual Script will discontinue in Godot 4.0. Therefore, it's useless to continue using Visual Script in Godot now.
A lot of people who use Godot's Visual Script want to get a variable value from another script. Here's how!
Just drag and drop a scene node, which is attached to the script, into the canvas as shown in the screen recording below:
A proper way to do it
As it has been pointed out in my previous tutorial, it's better to use an instance mode unless you are OK to fix every nodes if anything goes wrong.
- First, set a scene node that you want to get the variable from to an
object
variable in the_ready
function which will be called only once.
-
Change set mode of the node to Instance. And put the
object
variable to the instance input port.
I hope this helps 👍
Cover photo by olieman.eth on Unsplash
Top comments (0)