godotengine / godotengine/godot-docs

Better descriptions in ClassDb

Open
#8,770 2 comments 1 reaction 0 assignees View on GitHub
area:class reference enhancement
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

**Your Godot version:**
4.2.1

**Issue description:**
The descriptions an behaviours for `ClassDB.instantiate() `and `ClassDB.can_instantiate() `are misleading.

- `ClassDB.instantiate() `states _"Creates an instance of class."_
It should state _"Creates an instance of class **if that class is a Godot built-in class, otherwise returns null**"_

- `ClassDB.can_instantiate() `states _"Returns true if objects can be instantiated from the specified class, otherwise returns false."_
It should state
_Returns true if objects can be instantiated from the specified **Godot built-in class,** otherwise returns false._

Extra problem: `can_instantiate `returns "true" when I call it on a **custom** class, which is very misleading as `instantiate `later returns **null**.

Because of the vague descriptions, I realized way too late that I'd have to resort to such complicated extra code : https://gamedev.stackexchange.com/questions/208348/is-there-a-way-to-instantiate-a-custom-class-decided-at-runtime-in-gdscript

**URL to the documentation page (if already existing):**
https://docs.godotengine.org/en/stable/classes/class_classdb.html#class-classdb-method-can-instantiate

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.