Search code examples
c#godot

Is it possible to create new C# scripts with proper namespace?


I'm using the C# Mono version for Godot and would like to know if it is possible to configure Godot to make use of namespaces. When creating a new script at

./Folder/MyClass.cs

I would expect the namespace to be

MyProject.Folder

So the created file should be similiar to

using Godot;

namespace MyProject.Folder
{
    public class MyClass : Node2D { }
}

Is that possible?


Solution

  • I don't think it is possible to configure Godot to do this. To be clear, it is possible to create custom templates for scripts, see Creating script templates. However, as far as I can tell Godot does not offer a way to use the folder path (or its parts) in a template.