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?

asked Feb 12 in Engine by nioaps (21 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)

answered Feb 12 by Sween123 (726 points)
selected Feb 12 by nioaps
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.