0 votes

Hi, I'm remembering godot and I have forgot how to share positional data across scenes , I have a sprite3d that always needs to point at the player, and I need the player position for the look_at() function. I cannot use clones and prefer no signals, but can in a pinch. WHAT IS A SIMPLE WORKING METHOD TO SHARE DATA?,

(sorry for the demanding tone of this question)

Godot version 3.4
in Engine by (26 points)

2 Answers

+1 vote
Best answer

You could create a global.tscn scene.

You can add this to the list of autoloaded scenes in the project>Project Settings>Autoload. Once you have this you can add the global position to this scene rather than an individual script within a specific scene and it can be access by any of the other scenes then within the script with Global.YourFunctionOrVariableHere

Hope this gives you what you want.

by (1,635 points)
selected by

Thanks for the useful link

0 votes

Yeah you have to use a global.tscn scene for that to get the effect you want here.

by (14 points)
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.