0 votes

1.About load image,texture resources: I have imported all of my *.png inside my project

2.Then inside a *.gd file, i have a for loop. Inside that for loop, i call:
Example: var a = load("res://item/potion.png")

So, the detail questions are:

q1: How this load process work?

q2: Does this load method good or bad? In case it contain a lot of resources files (maybe 10k or even 100k resources files)

q3: Does this resources was load one time and cached or keep load again whenever enter that iterate?

in Engine by (20 points)

1 Answer

+1 vote
Best answer

Load is not like importing.
Your png files have already been imported into Godot and load simply means to load them in your scenes or code. The files have ".import" at the end. Same for loading a scene and instancing it.
So, "load" is commonly used in Godot.
Using a variable like var a = load("res://item/potion.png"), yes it's one time. It will be there all the time. (Unless you restart the program, again it's different from importing)

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