C# Naming Conventions (Unity Tutorial)

preview_player
Показать описание
In this video we're going to look at naming conventions in Unity.

We’ll go through why naming conventions are important, and then look at a slight change we’re planning on making to the naming conventions used in our videos.

The C# coding conventions form Microsoft can be found here

Help support our work:

Follow us:

#KetraGames #LearnUnity #UnityTutorials #UnityTips
Рекомендации по теме
Комментарии
Автор

"We're going to start adding an underscore prefix to our fields" should be "We're going to start adding an underscore prefix to our private and local fields.

Having said that, I've also seen a common variation on the MS recommendations which uses PascalCase for public, underscored camelCase for private and internal, but drops the underscore for Serialised private fields.

n_mckean
Автор

I don't use the underscore but seems like an useful change.

LuRybz
Автор

Hey Kendra, I found this video very helpful is there any chance you can make a tutorial about abilities. Cooldown and how to create them I'd really appreciate and it would really help me thanks.

evangaitis
Автор

Please show us how to add mobile input please, u explain way better than anyone else

ciyusufshaikh
Автор

plz tell me how can i add a ui button witch rotate my car forward and backward for a flip control plz tell me i really need help

DaveSucker
Автор

I changed my preference away from Microsofts recommendation a few months ago as I rather disliked using underscores which I had been using for a few years prior. I now use PascalCase for public fields/properties and CamelCase for private fields (Unity DOTS seems to follow PascalCase for public fields and I quite like it). For everything I've done, I can't really think of a reason why I need to know which fields are private and which ones are public. I could technically use the same Case for both and I doubt it would make much of a difference. As long as the fields are named in such a way that I understand what they are being used for then that's enough for me. If I require something to be accessible outside the class/struct etc then I'll simply change the access modifiers and Case accordingly.

odo
Автор

Im not a fan of the underscore for class variables, but it doesnt make it harder to follow someone who does so it is a non issue for me.

HalcyonVoid