1) Just add the resources via the ResourcePreloader
window.
2) I have been utilizing ResourcePreloader
for reusable ui widgets, which are saved as .tscn
files. As far as i can tell, everything a scene requires is preloaded. (In Video Mem tab of the debugger, unique textures associated with the preloaded scenes are present before they are used.)
When it comes time to instance a preloaded scene:
var widget = get_resource(widget_name).instance()
If you need to add a scene at runtime you can add it with the ResourcePreloader
's add_resource
function.
Usage example:
func load_and_instance(path):
var scene
var name = path.get_file().basename()
if preloader.has_resource(name):
scene = preloader.get_resource(name)
else:
scene = load(path)
preloader.add_resource(name, scene)
return scene.instance()