Would you watch a longer video explaining even more coding conventions for programming in unity?
@trzrekzii93612 жыл бұрын
Definitely
@HalcyonVoid2 жыл бұрын
Yes to all. I dont think there is any downside to having more content of any kind. The bite-sized videos are good for quick reference, and the longer videos are great for in depth explanation. And if anyone is like me, which I am sure I am not alone, I dont always need the deep explination for the basic stuff and want to get to the more complex stuff sooner, so I can refresh with the short videos and get up to speed faster.
@mracipayam2 жыл бұрын
yes/
@gamegrade82792 жыл бұрын
yup
@mihaianca86022 жыл бұрын
Absolutely! I need this!!!
@keryan13742 жыл бұрын
Doesn't matter how advanced you are, you'll always learn something on this channel. Thanks for the videos!!
@howdy_official Жыл бұрын
Fields and properties should be named in lowerCase, AFAIK. Build in Unity classes made the same way, for example Time.deltaTime etc.
@hakanviajando2 жыл бұрын
Thanks for the video. I loved the command pattern video, I hope there are more design patterns explained in the future.
@uwinhong2 жыл бұрын
short but useful video!!
@iHeartGameDev2 жыл бұрын
Glad you think so!
@Choco-sk2gj Жыл бұрын
Thanks just what I was curious about for Csharp! Really great channel
@theGreaterAwareness Жыл бұрын
In my own personal projects, I like using the Hungarian notation. I find it helps me differentiate between the different variables on screen.
@gg_ru2 жыл бұрын
I like short and informative videos like this one, would be great if you could make more of those!
@jasperjavillo6862 жыл бұрын
I remember when I first saw this clip when I first found your channel. This clip forever changed how I coded in Unity and my scripts have never been cleaner. Thank you for making this.
@iHeartGameDev2 жыл бұрын
Thanks so much Jasper! 😊
@tPlayerioT Жыл бұрын
sometimes i think its Enums that people uses all uppercase like: PLAYER_WALK, IDLE and honestly it looks more unique to enums and little funny
@epiksol_2 жыл бұрын
Great job, Nicky!!
@iHeartGameDev2 жыл бұрын
Thanks Daniel! Miss you bro!
@umapessoa60512 жыл бұрын
Nice video, that's something that should be used more often by programmers, it's always a hell getting a Unity freelance due to people ALWAYS missing naming conventions and writing poorly named variables, due to that i could never know if its a public, private or local variable
@iHeartGameDev2 жыл бұрын
Thanks Gabriel! Hopefully by sharing this info, devs are more likely to abide by the standard conventions!
@Giga4ever2 жыл бұрын
Sorry, but that's on you. You should provide the conventions(since they are subjective) and enforce them. There are a bazillion tools that do it automatically. So make passing the tools part of the requirements for the work and don't pick low quality programmers.
@laniakeadev.22712 жыл бұрын
In an article on this topic on Unity's github it did not memtion _underscore. I also don't use it because it aggravates readability and makes code ugly.
@Andrew-tl9gk Жыл бұрын
Within the Unity StarterAssets Third/First-Person Controller the Unity team uses exactly the style as he mentioned here with the underscores. There is also an official article from Unity from 2022 september where they mention the undescores the same way as he does in the video. I guess the underscore is used commonly in C# because there is no "this". So e.g. instead of other languages where you write "this.isRunning = true" it is "isRunning = true" and then underscore makes it more readable "_isRunning = true" so it is clear that its a class variable.
@euden_yt Жыл бұрын
It does help to know that the variable will not be accessed by external code. It also helps finding the variable faster in intellisense
@sir.niklas20902 жыл бұрын
I always thought that private var: _camelCase public var: camelCase | Without underscore.
@aleksapetrovic70882 жыл бұрын
I think it should be like that. Lets say you're declaring a variable of type PlayerMovement, if you named the variable the same as the class name, it's not that obvious whether you're accessing the actual class or the reference you have to it. // This is more obvious public PlayerMovement playerMovement; playerMovement.DoSomething();
@euden_yt Жыл бұрын
This is also what I use and what Rider recommends for fields that are visible on the Unity inspector. And PascalCase for public properties.
@kruth6663 Жыл бұрын
Are methods and functions two differrent concepts in c#? I thought they're the same thing.
@through-it4 ай бұрын
Every method is a function, but not every function is a method. Method exists only in a class context.
@darkdoom9072 жыл бұрын
Exactly, what I needed, I've been writing a lot of coupling codes, and this was the best help !!!!!💥
@iHeartGameDev2 жыл бұрын
Thanks for recommending this video, Dark!
@RazerFlexing2 жыл бұрын
Bro u saved me thank u so so so much
@iHeartGameDev2 жыл бұрын
Thanks for watching!
@Tarodev2 жыл бұрын
Great little video Nicky, I agree with everything you said.
@iHeartGameDev2 жыл бұрын
Thanks buddy! Your short and sweet videos lately had me all inspired!
@sergiosoba8 ай бұрын
And with [SerializeField] private... ???
@artimelessGames3 ай бұрын
A bit late but i guess you name it with an underscore because the variable is private to others classes (you can just change its value in the editor)
@ElboxD2 жыл бұрын
Nice vid mate! BTW, did you code your outro background video?
@iHeartGameDev2 жыл бұрын
Thanks very much! I made the background in Blender!
@ZiplawDev2 жыл бұрын
I use camel case as well in public and protected methods, and pascal case in properties, to denote that properties may execute some code in the getter or setter, and I only use _ for local variables in a function, when I need to differentiate from a global one
@iHeartGameDev2 жыл бұрын
If it works for you and anyone who reads the code 🤗
@ZiplawDev2 жыл бұрын
@@iHeartGameDev i find it does fit quite nicely, the only thing is private variables are indistinguishable from public ones inside their own class, but I'm to lazy to type underscores lmao
@alphaanar26512 жыл бұрын
That is just a sloppy naming convention.
@ZiplawDev2 жыл бұрын
@@alphaanar2651 care to elaborate?
@alphaanar26512 жыл бұрын
@@ZiplawDev not to throw shade on you, but, using camelCase for *any* public member and underscore for local variables only shows lack of your experience. Reconsider your conventions. Really if you gave your code for a review, the first thing mentioned would be such bad conventions you are following.
@litemystic2 жыл бұрын
Can you please make a video explaining Unity Timeline
@beninjensin2 жыл бұрын
Make a video on how to make ragdoll characters like human fall flat or gangbeast and self balancing them
@ВалерийГеннадьевич-в6ц2 жыл бұрын
Use this comment to represent that you are interested in "URP/HDRP Explained" video. Big thanks to author for all videos from this channel ;)
@Andrew-tl9gk Жыл бұрын
No come one, there are so many videos about this topic already...
@VEETEEGameStudio2 жыл бұрын
I've watched your state machine tutorial so much that it's already burned into my memory that this video clip is from there😅
@iHeartGameDev2 жыл бұрын
It’s true!
@alphaanar26512 жыл бұрын
I agree with majority of stuff mentioned here, except for this one: "always declare static fields on top". This may be the way "you" write your code, but it is definitely not a standard. A standard is to always put instance fields before static ones. Besides this little false convention, all in all, very decent video.
@charlesonis34842 жыл бұрын
So cool!
@iHeartGameDev2 жыл бұрын
@bunzy52792 жыл бұрын
If only it didn't matter! Truth be told C# is much easier than other languages so two rules like this isn't crazy bad.
@iHeartGameDev2 жыл бұрын
Not bad at all! Hopefully more people abide by the standards!
@scoontaquex33882 жыл бұрын
Thanks!
@jeffmccloud905 Жыл бұрын
I know Unity encourages it unfortunately, but public fields in a class in C# are not recommended. You should use property getters/and setters. Reference: all from the Microsoft docs since 2000... "Fields (C# Programming Guide)" and "C# Coding Conventions" and "Field Design". Public fields are "generally not recommended" and should "used sparingly" and even this: "❌ DO NOT provide instance fields that are public or protected."
@Angel-eg8xm2 жыл бұрын
PLEASE , MAKE A 100 HOURS UDEMY COURSE :/
@Balakademi2 жыл бұрын
Thanks
@rusluck6620 Жыл бұрын
meanwhile i be writing variables like examplevariable
@weckar2 жыл бұрын
i
@iHeartGameDev2 жыл бұрын
I
@quaintgamestudio61492 жыл бұрын
Great 👍🏿
@kensteelyhuntergames4842 жыл бұрын
1:25 trouble in that, what a this is not variables, its fileds
@mohsenmousavi23132 жыл бұрын
♥♥
@MichaelGGarry2 жыл бұрын
Hungarian notation. Anything else is inferior. Instantly know the scope and type of the variable just by looking at its name.
@hellfim2 жыл бұрын
Was expecting to see a bad coding convention, as in older tutorials you didn't follow them yourself. Yet, a good standard (mostly) one is shown. Thanks for the great tutorials and best of luck!
@BGDMusic2 жыл бұрын
time to do none of these XD
@twillij292 жыл бұрын
As long as no-one has to read your code lol
@BGDMusic2 жыл бұрын
@@twillij29 it's not gonna make much of a difference but people are gonna judge me probably
@twillij292 жыл бұрын
@@BGDMusic No, if people have to read your code then it's good to have some set rules and clarity. I don't know if you have experience going into a project mid-development but it's a nightmare to read code that doesn't have any conventions in place. If it's just you reading it, then it's probably fine.
@BGDMusic2 жыл бұрын
@@twillij29 it's just upper vs lower and some letters but idc it's whatever yeah ok you have a point
@BGDMusic2 жыл бұрын
distinguishing between different types of stuff is good but conversions only do so much
@Chronomatrix2 жыл бұрын
I prefer writing public variables using camelCase, I find it easier to read.
@alphaanar26512 жыл бұрын
Ew
@broganking98302 жыл бұрын
ALSO CONSTANTS IN ALL CAPS
@alphaanar26512 жыл бұрын
No, maybe in C and C++, but never in C#. ALL_CAPS is not a convention for anything and it is never mentioned in official pages. Class-level constants are still PascalCase, and local constants declared within a method scope is camelCase.
@broganking98302 жыл бұрын
@@alphaanar2651 It should be though. I would fail all code reviews for my Jrs if they don't haha rip
@alphaanar26512 жыл бұрын
@@broganking9830 I mean, you may still use ALL_CAPS (or other peculiar formats), it is not a big must to follow standard conventions in the end. But really this naming style does not fit C#, at all. (I subjectively think that it looks too ugly). Maybe it is time for code refactoring ;)
@mw36532 жыл бұрын
Talking about code convention and you didn't put the bracket of the example method on a new line. Awful video. This guy has no idea what he's talking about.
@iHeartGameDev2 жыл бұрын
I have no idea what I'm talking about. Thanks for pointing out the mistake. :)
@iHeartGameDev2 жыл бұрын
Worth pointing out that majority, if not all, articles that I've read regarding bracket spacing state that it's a preference as long as it's consistent throughout the project: softwareengineering.stackexchange.com/a/2786
@Masticater2 жыл бұрын
@@iHeartGameDev 😂I love that you dove into more research because of a joke
@iHeartGameDev2 жыл бұрын
@@Masticater :) I try really hard not to spread misinformation. Had to be sure I wasn’t 😵💫
@alphaanar26512 жыл бұрын
@@iHeartGameDev Nevertheless, the official one by Microsoft states that brackets ought to be placed on a separate line. C# is nothing like other languages where the placement of a bracket does not mater. But to be fair, it surely is not a reason to trash this video.
@flaschenzuglp99942 жыл бұрын
Fields are camelCase properties PascalCase. No _ Is Currently c# meta and in my opinion best to read
@Andrew-tl9gk Жыл бұрын
The underscore means "this." because in C# there is no "this"