Im still dumb, How can I share a 3d position across scenes using GDScript.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By uh no

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)

:bust_in_silhouette: Reply From: Gluon

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.

Thanks for the useful link

uh no | 2021-12-14 13:56

:bust_in_silhouette: Reply From: AaBanks

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