C# pain points in Godot

Godot Version

3.5

I have been developing an app with C# for a while now. I have some frustrations though, as much as I like the engine, there are things I wish worked better and hope future versions will address for us C# people.

1: Data transfer between classes. I find Godot is not good at sending data from one class to another. If it is an instantiated class, you often have to use call deferred to make it work but good luck trying to sent a data class over a function. You often end up sending some kind of identifier and then fetch the data from the class witch require another lookup. This is far from optimal and I hope someday it will be addressed.

Crashes without output in the console. These are common. You can get some help if you do a lot of try / catch and throws all over the place but it adds a lot of extra work to your bug hunting. I guess it have to do with memory management when using C#. It’s not super solid and your app will just crash. You can box your way through it

It would also be really nice if it wouldn’t start a new Visual Studio every time you click on a script from the Godot editor, but just open up the one you have open with your full solution already. Not a deal breaker but really annoying.

I am using version 3.5 since I want to be sure I can export to IOS and Android and MacOS as well as Windows. I know it’s coming to V4 but I am not in favor of developing on promised features. I hope I can move to version 4 for my next app.

When it works, it’s great and overall I like Godot but when it behave strange due to some Godot quirk, it is less fun. Ex-Unity developer her in case you wonder.

Hmm interesting, I rarely have crashes and when I do, it’s usually just the running app and not the editor. The bit I used C# in V3 and, currently, use V4, I have never had new instances of visual studio open for each script but instead the script opens inside the existing instance. I have a friend who uses C# all the time and has never had this issue so maybe that’s a V3 issue specifically.

I thought only web was missing in terms of C# support in V4 but it’s always possible I misunderstood something in the January post

I find Godot is not good at sending data from one class to another

this is why i prefer c#, because c# is way better at this.

i am assuming you aren’t new to programming. how are you sending data from one class to another?

using Godot;
using System;
public struct MyData {
	public MyButton m_sender;
	public string m_message;
}
public partial class MyButton:Button {
	MyButton m_recipient = null;
	public override void _Ready() {
		m_recipient = GetNodeOrNull<MyButton>("/root/Test/Parent");
		if(null == m_recipient) {
			m_recipient = GetNodeOrNull<MyButton>("/root/Test/Parent/Child");
		}
	}
	public override void _Pressed() {
		MyData v_data = new MyData {
			m_message = $"message from the past: {Name} sending data to {m_recipient.Name}",
			m_sender = this
		};
		m_recipient.Receive(v_data);
	}
	public void Receive(MyData a_data) {
		GD.Print(a_data.m_message);
		GD.Print(Name, " received data from ", a_data.m_sender.Name);
	}
}