godotengine / godot-docs

Godot Engine official documentation
https://docs.godotengine.org
Other
3.96k stars 3.23k forks source link

GDScript's load() method has an innaccurate/misleading sentence in the description. #9843

Open Daniilik opened 2 months ago

Daniilik commented 2 months ago

Your Godot version: 4.3

Issue description: The description for GDScript's load() has the following sentence: "To avoid unnecessary delays when loading something multiple times, either store the resource in a variable or use preload." This is contradicted by the fact that load() uses ResourceLoader.CACHE_MODE_REUSE, therefore "loading something multiple times" would simply fetch from the cache and incur no unnecessary delays. As it stands, the documentation recommends to re-implement a cache on top of an already cached value. I would propose to erase it entirely or replace the sentence with a slightly different one, like "To avoid unwanted delays when loading something for the first time, either load it earlier and store the resource in a variable, or use preload."

URL to the documentation page: https://docs.godotengine.org/en/stable/classes/class_%40gdscript.html#class-gdscript-method-load

If you know how to fix the issue you are reporting please consider opening a pull request. We provide a tutorial on using git here: https://docs.godotengine.org/en/stable/community/contributing/pr_workflow.html, writing documentation at https://docs.godotengine.org/en/stable/community/contributing/docs_writing_guidelines.html and contributing to the class reference here: https://docs.godotengine.org/en/stable/community/contributing/updating_the_class_reference.html

AThousandShips commented 2 months ago

This assumes you keep a copy around that's valid when you load again, the resource will only be cached for as long as at least one instance is around