C# and Unity scripting

I am learning c# currently however most of the i learned is about Windows form applications I want to ask Is C# same everywhere? like Windows forms,console application and unity

Windows Forms is functioning a bit different in terms of using something. Unity got its own Script Language / Classes which you have to learn. But basically if you are a good c# programmer, it will be easy for you to learn the Unity scripting. I was starting with Unity after I got my education in Computer Science and it felt easy for me to program with Unity.

One example of difference between C# classic programming and Unity programming:
In C# there is always the void “Main” which is called at the start of the program. In Unity there is s void “Start” which is called once at the beginning of the game and the void “Update” which is called every frame.

1 Like

C# is a language.

WinForms is a library.

Unity does not have the WinForms library built in, primarily because WinForms is not cross platform. You can include the dll’s for WinForms, but then you can only target Windows desktop with your game. Although really… most of what WinForms does is not needed in Unity. You ‘might’ like the dialog box or something in WinForms, but you can also roll a Unity centric dialog box instead.

Unity uses the C# language, a large portion of the base System library from .net/mono. And has it’s own UnityEngine library that you would use.

1 Like

If it’s purely about the language (and its syntax) itself, there’s not much of a real difference. After all, C# is a programming language with a clear specification.
Some differences down on the language level are, that you’re not able to use the very latest C# features. For instance, ref returns and local functions and such. Though Unity currently leaped a huge step forward by providing (experimental) support for .NET 4.6.

If it’s more about the libraries that you’re used to code your applications with, or the overall concept of approaching the design of an application, there are a few differences that you’ll surely get used to very quickly, unless you still struggle with the language itself.

1 Like

if you know C# and you are familiar , you only need to learn classes and functions,… in unity and then you can easily use all of them appropriately

1 Like

so where should i start? learning winForms have any benefits for me?

If you learned C# in the process, it’s helpful, imo. However, if you’re looking to move to working with Unity, and you are not looking to continue learning winForms, you can simply leave it behind.

There are a lot of C# starter tutorials - I’m not sure how far along you feel you are in your learning - that you can use. When you start with Unity, as mentioned, you just have to use your understanding of the language and discover/learn Unity’s API.

:slight_smile: Welcome, by the way.

1 Like

no . you have to face unity so face it