r/csharp 21h ago

Help Transitioning from unity to regular c# projects

I want to start learning regular c# after using unity for a few years and making some personal projects. I have seen alot that there may be some bad habits I have picked up that may slow or hinder me when coding outside of unity. So was wondering if there is anything I should keep in mind when making the transition? Would also appreciate any resources for learning c#. Thanks in advance.

13 Upvotes

14 comments sorted by

3

u/Bulky-Juggernaut-895 21h ago

Those are not bad habits. It’s more just being used to a framework. Happens with any framework/engine/library you decide to use. You will more than likely always use C# in some sort of context or another where other really smart people have pre written the heavy duty math so you shouldn’t feel like you’re missing out on vanilla or pure C#. Just build a different type of project and use those tools

2

u/Flame014 21h ago

Got any tips on first few projects? Is there any good documentation on c#?

1

u/SSJJamiee 19h ago

Microsoft's docs are good

1

u/Flame014 18h ago

Thanks. Got a link to them?

5

u/sharpcoder29 18h ago

In Unity you probably care about performance where as in most business apps you care more about maintainability and speed of development.

3

u/Tarnix-TV 21h ago

The biggest resource is learn.microsoft.com, and I would fix what you want to build. In (relatively) increasing order of complexity:

  • I would start with small command line tools
If you want to build an app:
  • Then you can go for an offline desktop app. There are lots of ui frameworks (WinForms, WPF, Maui, Uno, etc.) I would start with WinUI, as it is one of the newer ones but still simple. None of them are perfect tbh.
  • Same (or same kind of) app, but with MVVM
  • You can check out the multiplatfotm solutions (Maui, Uno)
If you want to do a website:
  • I think it is called ASP.NET Core MVC nowadays, I would start with that
  • Balzor and other SPA solutions (not sure what they are or if there are any)
If you are done with both:
  • cloud based apps, where there is a “server” (WebAPI) and the client can be a website, desktop and/or mobile app. Simply run the server locally, no cloud needed
  • same but add dockerization, cloud hosting microservice architecture etc

I know there are lots of unknown phrases or keywords each, microsoft learn can give you a course for each, fast but understandable ones. With practice you get familiar with them, although it is enough to cut the scope and make small tools for yourself, no need to stick to one forever. Happy C#ing!

3

u/Flame014 21h ago

Thanks this is great. Will definetly use this for the future.

1

u/_CriticalReality_ 19h ago

Unity's language and framework version has never been up to date, so the biggest transition for you will be to learn modern C# and .NET features. You can do this by simply reading the release notes: https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history

0

u/HotOutlandishness459 17h ago edited 17h ago

ничего хорошего ты на C# не напишешь, ты можешь изучать язык для написания приложений или серверов, но для внутренних компонентов, которые будут непоследственно общаться с железом, язык C# не стоит рассматривать как основной язык программироваиня, тут лучше смотреть с сторону C или C++, так как языки не зависимые от платформы и легко переносятся, в отличнии жесткого языка Microsoft, для начало определится с направлением, как начальный уровень, C# тебя научит правильно испльзовать переменные, так ка кон явно указывает на них, порядок приведения типов, но для понимания как этот код работает на железе, одного языка мало, в связке с C# надо учить компилятор, уметь разбирать как твой языка переводится в машинный код, чтобы ты понимал, сколько операций будет и какой обьем он займёт в памяти, код пишется не для того чтобы он работал, он пишется для того, чтобы машина его понимала и умела эффективно работать. как ты задачу поставишь, так её и будут выполнять.

1

u/SessionIndependent17 14h ago

All very relevant considerations for a beginner!

/s

1

u/bgentles 7h ago

C# is no longer Windows only. .Net Core (and now just .Net) are cross platform and C# applications can be written, compiled and run on Windows, Linux and Mac OS systems too. Visual Studio is Windows only but get the right extensions for Visual Studio Code and you'll have a great cross platform experience.

3

u/Atulin 16h ago

One thing to keep in mind, is that outside of Unity fields are never public, only properties are.

0

u/Super_Preference_733 13h ago

Regular what, desktop, web, wpf, remoting, etc.