Gdscrpit vs C# - what do you prefer?

I wonder what do you guys prefer for scripting language?
Coming from Java programming world, I always missed proper encapsulation and interfaces with GDScript. Just switched my project to C# and I marked 90% of fields private.
It feels so good. Finally knowing exactly what should be called from outside and what not. I know people use _ prefix for marking private stuff, but it feels much better when compiler makes sure you don’t accidentally use them. Also, code completion gives me just public methods and field makes coding much more enjoyable.

1 Like

That depends.

In Godot, I prefer GDScript and that’s what I use almost exclusively, as it’s better documented, has a bit more features than C#, and is easier to use. I like the fact that I can just open Godot and start writing, no more setup required as opposed to C# with a separate IDE etc.

In general however, I prefer strongly typed languages, with the features you mentioned. My background is Unity, so I’m used to C# and I like it a lot as a language. Even though I use GDScript, I usually try to make my code as type-safe and explicit as it allows me, so I’m somewhere in the middle.
I think if Godot had the possibility to properly parse C# in its native editor - I would most likely switch to C#.

I would love to see a hybrid in the future - GDScript syntax with fully type-safe capabilities, private properties and methods, traits, etc. Very slowly, but we’re getting there :slight_smile:

2 Likes

I am using C# as well, mainly because it’s easier to apply OOP pattern (for me) and because I am experienced with it.

1 Like

Yeah, I totally agree it’s more convenient to have code integrated into the engine. But I find it less annoying to switch between Godot and VS Code then I expected. I feel like I have more space for the code view.
It would be awesome to see private modifier added to GDScript. I miss that the most.

Thanks for your reply, foldear,
Did you ever experience any issues because of using C#, like additional performance cost compared to GDScript? Or some missing features, like preload() function?

Give these proposals a solid thumbs-up then! Hopefully we’ll see them being added one day.

1 Like

GDScript, it’s just so easy and straight forward in my opinion. I used to use c# in unity, but gdscript is just so much simpler, i also have a background in python and gdscript is a bit more pythonic in nature, it just feels more natural for me. The documentation is also super helpful.

Thanks for sharing the links. Just voted for both.

I agree it’s simple, and I mostly like it too. However, on bigger code base, it’s much harder to keep things organized without encapsulation and clean interface definitions.

1 Like

I’m new to Godot, I’ve just been tinkering with it for a couple of weeks now, so I haven’t used any GDScript at all, I am not the best person to ask ahah. For now, it’s just a matter of preference, but I’ll definitely try GDScript to see the differences.

1 Like

Thinking more about this, it would probably require GDScript to become compiled language in order to show invalid access errors in the code. I really don’t know how does GDScript executes currently, I guess it’s interpreted in runtime. Having the compiler which can check invalid access during building/exporting the project (or even before like some IDEs like VS Code do) would be awesome. However I guess it’s a huge change compared how it works today,