Why you should NOT make everything PUBLIC!

Описание к видео Why you should NOT make everything PUBLIC!

🌍 FREE C# Beginner Complete Course!    • Learn C# Beginner FREE Tutorial Cours...  
🔴 Watch my Complete FREE Game Dev Course! 🌍    • Learn Unity Beginner/Intermediate 202...  
🌍 HumbleBundle MEGAPACK https://cmonkey.co/humblebundle
✅ Unity Summer Sale (ends soon) https://assetstore.unity.com/?aid=110...
🌍 Get my Complete Courses! ✅ https://unitycodemonkey.com/courses
👍 Learn to make awesome games step-by-step from start to finish.
🎮 Get my Steam Games https://unitycodemonkey.com/gamebundle

💬 As you're starting out you might learn to set things as public in order to expose them in the Editor.
In this video I tell you why you should NOT do that!
The reason is to write good clean code that minimizes code complexity. The less accessible your variables are the better.
If you have an error with a variable that is set to public, you don't know where the error comes from, it might be in that class or any other class in your entire code base since every class can modify that field.
However when you set it to private you make sure that any issues that occur have to be happening from within that class, that really helps on keeping a smaller mental model of what your code is doing.
And if you want to expose a variable in the editor, simply use the attribute [SerializeField]
That way you keep your code nice and clean but still keep it editable in the Editor.

🌍 Get my Complete Courses! ✅ https://unitycodemonkey.com/courses
👍 Learn to make awesome games step-by-step from start to finish.

🌍 Get Code Monkey on Steam!
👍 Interactive Tutorials, Complete Games and More!
✅ https://store.steampowered.com/app/12...

If you have any questions post them in the comments and I'll do my best to answer them.

🔔 Subscribe for more Unity Tutorials    / @codemonkeyunity  

See you next time!

📍 Support on Patreon   / unitycodemonkey  
🎮 Grab the Game Bundle at https://unitycodemonkey.com/gameBundl...
📝 Get the Code Monkey Utilities at https://unitycodemonkey.com/utils.php

#csharp #unity #programming #unitytutorial #gamedev

--------------------------------------------------------------------
Hello and Welcome!
I'm your Code Monkey and here you will learn everything about Game Development in Unity using C#.

I've been developing games for several years with 8 published games on Steam and now I'm sharing my knowledge to help you on your own game development journey.

I do Unity Tutorials on just about every topic, Unity Tutorials for Beginners and Unity Tutorials for Advanced users.

You can see my games at www.endlessloopstudios.com
--------------------------------------------------------------------
- Other great Unity channels:
Unity -    / unity3d  
Brackeys -    / brackeys  
Dani -    / @danidev  
Jabrils -    / @jabrils  
BlackthornProd -    / @blackthornprod  
Sykoo -    / sykootv  
Jason Weimann -    / @unity3dcollege  
Jonas Tyroller -    / @jonastyroller  
--------------------------------------------------------------------

- Website: https://unitycodemonkey.com/
- Twitter:   / unitycodemonkey  
- Steam: https://store.steampowered.com/develo...

Комментарии

Информация по комментариям в разработке