Hi there

I'm making a plugin, and I want to prevent possible name clashes when people install my addon. Considering there is no namespace support in GDScript, what are the best practices to do so?

I did some search but didn't find good tutorials on this. If you have some links I'd appreciate if you share them too.

Thanks

You can use classes as namespaces, and try to make the class names specific to minimize the risk of someone else using the same class name.

Even if there's a conflict, the user can rename the plugin's classes or his own classes to remove the conflict.

You might create a discussion in https://github.com/godotengine/godot-proposals to explore ideas. But there are some control freaks there who might kill the discussion.

    DaveTheCoder Thanks for the reply. That's the approach I'm currently implementing, but I wasn't sure if this is a good approach. However, the system doesn't seem to be working. I have it like this:

    I have some const variables in a global autoload enabled by the addon, (called for example NameSpace):

    const TypeName = preload("res://addons/my_addon/TypeClass.gd")

    I expect it to work like this (other scripts):

    @export var my_var:NameSpace.TypeName

    Does it work like this? The custom editor properties don't seem to be working, but I guess there is some problem somewhere else and the NameSpace thing should work.

    Edit: I keep getting this error and none of my EditorProperties work in the inspectors:

    Failed to set a resource of the type 'Resource' because this EditorResourcePicker only accepts "blahblah.gd"

      while-free- const TypeName = preload("res://addons/my_addon/TypeClass.gd")

      I haven't tried that method. I define new classes by placing class_name at the top of the .gd file.
      Examples:

      class_name CryptGodot3
      @tool
      extends Control
      class_name RadialProgress

        DaveTheCoder I'm adding a global.gd to my plugin, and put a list of preload const references and use them as "types". It doesn't seem to be working, but it's supposed to work (as far as I've searched). Have no clue what the problem is.

        The global.gd script is autoloaded by the script and is working correctly. But the custom inspectors and editorproperties don't seem to be working...