mastodon.gamedev.place is one of the many independent Mastodon servers you can use to participate in the fediverse.
Mastodon server focused on game development and related topics.

Server stats:

5.6K
active users

Godot 4 Question
----------------
Context: Writing an Addon in gdscript.
Aim: Create scripts at runtime & have class_name registered.

I need to make scripts like:
class_name Foo
extends Resource

and:
class Bar
extends Foo

Hence Foo and Bar must be 'known' by Godot.

I can make, write and new() the scripts but Godot does not recognize the class names.

Any ideas? Super stuck. 😔

@dbat It looks like ScriptServer is not exposed to GDScript, so I doubt you can register global class at runtime. Those classes are stored in ProjectSetting and main.cpp reads them only once at initialization.
Do you need classes to be global? You could try `extends res://path` instead. Or keep a Dictionary of substitutions and replace a user typed class with a path at runtime.

dbat :godot:

@limbo Thanks Limbo. I have just started down that road. Thanks for the term "ScriptServer" - might help me to search in future.

🏆