godotengine / godotengine/godot-docs
How to obtain a list of custom classes should be more discoverable
- Dominant language
- reStructuredText
- Stars
- 5.7k
- Forks
- 3.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 25
Description
**Your Godot version:**
v4.0.beta13
**Issue description:**
The only hint for how to get a list of a project's custom class_names is currently inside of a comment inside of an example code block inside the Variant class page. This information would be more useful as a note in the ClassDB `get_class_list` method (which only returns built-in classes) or wherever `class_name` is documented (closest I could find is the "registering named classes" section of gdscript basics, but it may not be appropriate there).
This is especially difficult to know how to do without good docs now that the custom class list has been [moved out of the project file](https://github.com/godotengine/godot/pull/70557) and into a hidden cached file. It took me a long time to track down how to do it, so here's the snippet of example code that does it post-beta13.
```
var config = ConfigFile.new()
config.load("res://.godot/global_script_class_cache.cfg")
var custom_class_list = config.get_value('', 'list', [])
```
I haven't contributed to these docs before, but I'm happy to do this work if anyone agrees that it would be useful & decides on the page that it should live.
**URL to the documentation page (if already existing):**
Currently in:
https://docs.godotengine.org/en/latest/classes/class_variant.html
Would be more contextually relevant in:
https://docs.godotengine.org/en/latest/classes/class_classdb.html#class-classdb-method-get-class-list
https://docs.godotengine.org/en/latest/tutorials/scripting/gdscript/gdscript_basics.html#registering-named-classes
Contributor guide
No contributing guide indexed for this repository
Research direction
Review the existing note in classes/class_variant.html and compare the ClassDB get_class_list section with the GDScript basics “registering named classes” section. Decide which location best explains how custom class_names are listed after the cache moved, then document the res://.godot/global_script_class_cache.cfg approach and verify the relevant documentation links and formatting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- godot
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100