Better C# Class Library Support #7158
QueenOfSquiggles
started this conversation in
Scripting
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
A bit of warning I might get some terms mixed up, I don't have professional education of C#, I just know how to make code do the things I want.
One of the things I like to do with my C# projects in Godot is to set up several class library files in different folders. I make a tiered system like this:
Where each section is a class library that depends on the previous. So
addons
are unable to reference anything andGame
code is able to reference everything. Another main benefit is that the class libraries are compiled indepenently so if I make changes in theScenes
library, OnlyScenes
andGame
will need to be recompiled. As the project grows larger this has an even more drastic effect on compile time.The problem I have been having is that Godot seems to have no knowledge of these class libraries. I set them up using the dotnet CLI. And the references are made in the project root solution file. So everything compiles properly and works without really any issue.
The main problem is that when I upgrade to a newer version, for example going to 4.0 stable to the 4.1 betas (for the
GlobalClass
attribute), only the project rootcsproj
file updates the SDK reference. So I have to run through all of the class libraries to update their SDK references manually.My Ideal Solution
I have some experience with Unity (several years old now). And one of the features that I used a lot there were
AssemblyDef
, which are essentially in-editor files that can be managed with their dependencies and meta data which is pushed out to thecsproj
files.The Unity Documentation on this is really helpful for describing what I want.
I can understand that Godot will have its own style of implementation, but I feel that this is a feature that could enable much larger projects to be made with C# in Godot. It speeds up compile times for larger projects while also maintaining a stricter dependency management through C#'s assembly referencing.
Beta Was this translation helpful? Give feedback.
All reactions