Closed jasonswearingen closed 5 months ago
Thanks I will check that. It seem to be a godot bug or some oversight.
oh one more thing, this only happens when the scene has the [Tool]
attribute. without it there is no error.
also, I just tested on Godot 4.3dev6.mono
and it's still occuring
The scene? Do you mean the bridge class? Could you give me a snipet of your code?
The scene that I'm instancing the bridge from is a [Tool]
. it's something about how the Editor cold-reloads tool code.
here's an example of what i'm doing
[SceneTree]
[Tool]
public partial class Main : Node
{
public World World { get; set; }
public PhantomCamera3DBridge pcamBridge { get; set; }
public Node3D pcam { get; set; }
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
World = new();
AddChild(World);
var xbotCharacter = _GD.InstantiateScene<xbotCharacter>();
this._AddChild(xbotCharacter);
pcam = _.PhantomCamera3D;
pcamBridge = new PhantomCamera3DBridge(pcam);
}
//more code......
Bridge used with [Tool] class are special case. Adding a parameter less constructor to the genereted class would lead to confusion on it use. It would be best to add it manually as a partial class.
Hello, I am running into a weird edge case.
When rebuilding my csharp project in my IDE, the godot editor does a cold-reload, and throws this error:
Not sure why the editor needs that, but it seems to be because cold-reload calls the default constructors on all .net objects.
Adding this code manually fixes the problem:
so, maybe this should be added to the generated code by default?
This is on Godot 4.2