get_class() return "extended class" name instead of custom "class_name"

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By websterek

Hi

I have create extension of Position3D class with my custom name, it looks like this:

extends Position3D

class_name CrossControl

But when I’m asking for the class using get_class() function it’s still returning me original name (Position3D).

How to create a new class that returns its name correctly?

For now I’m just overriding get_class() function but I’m not sure that it’s correct way?

https://github.com/godotengine/godot/issues/21789

Dlean Jeans | 2019-07-07 10:24

:bust_in_silhouette: Reply From: Thomas Karcher

I don’t know why Dlean Jeans didn’t post his link as answer, because this Github issue sums up the whole discussion nicely:

Yes, overriding get_class() is currently the best way to do it, but this issue is being discussed already and might lead to a changed behaviour of get_class in the future.