0 votes

Hello everyone.
I'm looking for a way to send variables to different scenes.
What would be the best way of doing so?

in Engine by (12 points)

1 Answer

0 votes

Using global.gd. Take a look at singletons :

http://docs.godotengine.org/en/3.0/getting_started/step_by_step/singletons_autoload.html

Then, you can access variables in any scene, for example:

var highscore = global.hiscore 
by (91 points)

What i want to do is scores. For example if enemy has 0 hp then he emits signal or something, that the hud scene receives and adds to the score. And don't think singletons would work for something for this. If they would could you send me a link where I could find out how to do it?

Nvm, just did it. Thank you it really helped.

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.