The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

Hi everyone,

A script calls a function in another Node's script 10 times in a row (each time interrupted by a short 0.1 yield).

extends Node2D

func _call_me_10_times():
    var something = preload("res://scene/path.tscn").instance()

    call_deferred("add_child", something)

I just want to be sure: that preload is still being loaded only once, right? Not 10 times. A load would be loaded 10 times, but not a preload, right?

Godot version 3.3
in Engine by (525 points)

1 Answer

0 votes
Best answer

https://docs.godotengine.org/en/3.3/getting_started/step_by_step/resources.html#loading-scenes

On the last paragraph it says

without having to load them again from disk each time.

So yeah preload loads the scene at compile time so it doesnt load it every time you call it.

by (600 points)
selected by

For some reason I just really needed that confirmation, thank you very much.

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.