Tested versions
v4.4 stable
System information
Debian 13
Issue description
CSharp classes that have the globalclass attribute and no parameter-less constructor are treated as if they have a parameter-less constructor.
using Godot;
using System;
[GlobalClass]
public partial class Test : Godot.Node2D
{
// This class doesn't have a parameterless constructor but godot is creating it without parameters.
public Test(Vector2 position)
{
Position =position;
}
}
This fix should probably be done for classes with generics too.
using Godot;
using System;
[GlobalClass]
public partial class Test<T> : Godot.Node2D
{
}
Generics actually error so they are less of a problem.
What should happen in both cases is either...
- A dialog comes up to pass in parameters and generics.
- The classes compiles fine and is shown but acts as a abstract class in the node dialog.
- They are clear compile time errors.
Of course abstract classes should be able to be parameterized and generic since they are never created.
Steps to reproduce
- Download example project.
- Open it.
- Look at script.
- Try to create it in scene.
- It works fine but it's not constructed correctly.
Minimal reproduction project (MRP)
csharp-parameter-bug.zip
Tested versions
v4.4 stable
System information
Debian 13
Issue description
CSharp classes that have the globalclass attribute and no parameter-less constructor are treated as if they have a parameter-less constructor.
This fix should probably be done for classes with generics too.
Generics actually error so they are less of a problem.
What should happen in both cases is either...
Of course abstract classes should be able to be parameterized and generic since they are never created.
Steps to reproduce
Minimal reproduction project (MRP)
csharp-parameter-bug.zip