Godot Version
4.3
Question
I notice in the docs they show using a var for preloads, like this…
var diamond = preload("res://diamond.tscn")
…whereas if you ctrl+drag a scene from the file browser to the script editor, it defaults to a const like this…
const diamond = preload("res://diamond.tscn")
Is one or the other of these correct? Does it depend? And if so, what does it depend on?
My intuition would be that since you almost certainly won’t be changing the file path at runtime, that const would be the way to go, but I’ve also noticed at times I’ve seemingly had issues when using consts and instancing scenes, especially when for example I instance a scene, queue_free it and then try to load a new instance of that scene. I’ve not been able to recreate this consistently, so I’m not sure what the actual source of the issue is.
At any rate, thanks for any insight!