- 9
- 221 199
Tesseract
United States
Приєднався 4 вер 2021
20 Advanced Coding Tips For Big Unity Projects
End spaghetti code! Learn the tools you need to write scalable, well-structured, clean code. So many game developers are forced to scrap their ambitious Unity games because they don't know these tips. As a young, self taught game developer, I didn’t discover these tools and techniques for years. Hopefully this video will help you to skip the learning curve and expose you to some of the more advanced programming devices that don’t get enough attention from the plethora of beginner Unity tutorials.
//chapters
00:00 - Intro
01:12 - Variable Names
02:11 - Comments
02:58 - Encapsulate in Functions
03:36 - Plan Your Code
03:57 - C# Properties
04:38 - Serialize Field
05:02 - Component Architecture
06:00 - Enums
06:25 - Coroutines
07:32 - Invoke/Invoke Repeating
08:03 - Structs
08:50 - Singletons
10:38 - C# Events
12:34 - Unity Events
12:56 - Interfaces
14:34 - Inheritance
17:50 - Scriptable Objects
19:15 - Custom Editor Tools
20:25 - Use Version Control
21:00 - Refactor Often
21:38 - Outro
//socials
Instagram: tesseract.yt
TikTok: tesseractyt
//long description
So you finally decided to begin work on your “dream game”, a fantasy MMO RPG sandbox battle royale powered by a blockchain economy. What could possibly go wrong? Then, two months later, progress comes to a grinding halt. You have scripts that are a thousand lines long, you’ve forgotten what your old code does, adding new features means you have to rewrite three old ones, every script relies on every other one, and overall, your project becomes an unorganized, unmanageable, confusing, dumpster fire of spaghetti code. Tragically, you are forced to scrap the project and give up on your game dev dreams. Sound familiar?
There are hundreds of hours of Unity tutorials online, but very few are geared towards more advanced developers aiming to create large scale commercial games. That’s why I’ve compiled a list of some of the most valuable unity coding tips that I’ve learned over the years, along with examples of how I’ve actually used these techniques in my own game. Hopefully, by the end of the video, you’ll have the tools you need to write scalable, well structured, clean code that won’t come back to bite you down the road.
//music
Evan King - Nightmares and Violent Shapes
ua-cam.com/channels/T1Z.html...
contextsensitive.bandcamp.com/
Internet Historian: Sthlm Sunset - Ehrling, A.X - Ehrling, Night Out - LiQWYD
ua-cam.com/video/wS5R3LnXC2o/v-deo.html
Music from Uppbeat (free for Creators!):
uppbeat.io/t/mountaineer/fly-away
License code: VVIYH4NIZH0ARSHF
uppbeat.io/t/hartzmann/joyful-lights
License code: AMYFJECHAZAJGCMI
uppbeat.io/t/swoop/lucidity
License code: Z6V3SJ5TMSRFUKKU
uppbeat.io/t/movediz/summer-vibes
License code: F9CFDRM8JFBQIVOD
//hashtags
#unity #unity3d #unitytutorial #gamedevelopment #coding #programming #indiegame #cleancode #codingtips
//chapters
00:00 - Intro
01:12 - Variable Names
02:11 - Comments
02:58 - Encapsulate in Functions
03:36 - Plan Your Code
03:57 - C# Properties
04:38 - Serialize Field
05:02 - Component Architecture
06:00 - Enums
06:25 - Coroutines
07:32 - Invoke/Invoke Repeating
08:03 - Structs
08:50 - Singletons
10:38 - C# Events
12:34 - Unity Events
12:56 - Interfaces
14:34 - Inheritance
17:50 - Scriptable Objects
19:15 - Custom Editor Tools
20:25 - Use Version Control
21:00 - Refactor Often
21:38 - Outro
//socials
Instagram: tesseract.yt
TikTok: tesseractyt
//long description
So you finally decided to begin work on your “dream game”, a fantasy MMO RPG sandbox battle royale powered by a blockchain economy. What could possibly go wrong? Then, two months later, progress comes to a grinding halt. You have scripts that are a thousand lines long, you’ve forgotten what your old code does, adding new features means you have to rewrite three old ones, every script relies on every other one, and overall, your project becomes an unorganized, unmanageable, confusing, dumpster fire of spaghetti code. Tragically, you are forced to scrap the project and give up on your game dev dreams. Sound familiar?
There are hundreds of hours of Unity tutorials online, but very few are geared towards more advanced developers aiming to create large scale commercial games. That’s why I’ve compiled a list of some of the most valuable unity coding tips that I’ve learned over the years, along with examples of how I’ve actually used these techniques in my own game. Hopefully, by the end of the video, you’ll have the tools you need to write scalable, well structured, clean code that won’t come back to bite you down the road.
//music
Evan King - Nightmares and Violent Shapes
ua-cam.com/channels/T1Z.html...
contextsensitive.bandcamp.com/
Internet Historian: Sthlm Sunset - Ehrling, A.X - Ehrling, Night Out - LiQWYD
ua-cam.com/video/wS5R3LnXC2o/v-deo.html
Music from Uppbeat (free for Creators!):
uppbeat.io/t/mountaineer/fly-away
License code: VVIYH4NIZH0ARSHF
uppbeat.io/t/hartzmann/joyful-lights
License code: AMYFJECHAZAJGCMI
uppbeat.io/t/swoop/lucidity
License code: Z6V3SJ5TMSRFUKKU
uppbeat.io/t/movediz/summer-vibes
License code: F9CFDRM8JFBQIVOD
//hashtags
#unity #unity3d #unitytutorial #gamedevelopment #coding #programming #indiegame #cleancode #codingtips
Переглядів: 201 793
Відео
Making my Game a Real Game | Indie Game Devlog #4
Переглядів 3,9 тис.2 роки тому
I'm making a top down shooter multiplayer mobile game! In this video, I work on the game's main menu and match loop. This includes a loadout screen, weapon select screen, lobby, match timer, match scores, match start and end sequence, and more. I also polish the game up to prepare for public playtesting with TestFlight on IOS. Play-Testing Discord: discord.gg/w5GQ8mHTp4 Flight Test Link (if you...
Designing the Ultimate PVP MAP for my Multiplayer Game | Indie Game Devlog #3
Переглядів 2 тис.2 роки тому
This is devlog#3 for my multiplayer, top down shooter, indie mobile game Ultimate Battle Arena. In this video, I design and implement my game's first PvP map. My goal is to make Ultimate Battle Arena the first actually good mobile shooter. It will have simple controls, lots of satisfyingly weapons, a variety of characters with abilities, class creation, strategy, and exciting movement. //social...
Can I Make Elden Ring in 10 MINUTES? | Unity 3D
Переглядів 6 тис.2 роки тому
Join me as I create Elden Ring in 10 minutes using the Unity Game Engine. Yes, the whole thing... Okay fine, only one "boss battle". I may have cut a few corners... It's really just souls-style combat. Keep in mind that this is not a tutorial, it is more of a challenge video with the goal of being educational for beginners and entertaining for all. If you are interested in game development, thi...
Adding SHOTGUNS to my Multiplayer Mobile Game | Indie Game Devlog #2
Переглядів 9662 роки тому
This is the second devlog for my online multiplayer top down shooter mobile game called Ultimate Battle Arena. In this video, I add shotguns, submachine guns, weapon switching, UI, animations, dive rolling, and audio in an effort to purge the game from lameness (lame and shotguns don't really coexist). Watch till the end to see the most satisfying kill montage ever. The game is made with the Un...
Using Python to Unsubscribe From College Emails
Переглядів 6952 роки тому
Fighting college spam with the power of Python and Selenium web scraping. Ever since I took the PSAT almost three years ago, my inbox has been cluttered with thousands of unopened emails from colleges that I have no interest in. I'm going to program a bot to log into my email account, detect college emails, and go through the unsubscribe process for each one. I guess you might learn some things...
Networking, Explosions, AI, Oh my... | Indie Game Devlog #1
Переглядів 1,6 тис.2 роки тому
This is the second devlog for my indie game Ultimate Battle Arena. UBA is an online multiplayer, top down, twin stick shooter game meant for mobile. I'll talk about how networking works in multiplayer games, my struggles implementing networking, the glorious results after getting networking working, and then some stuff not related to networking. I added grenades and explosions with MaTh, and I ...
Can I Make Flappy Bird in 10 MINUTES? | Unity3D
Переглядів 3 тис.3 роки тому
Let's make Flappy Bird together... or rather, a scuffed version of it, "Flappy Egg" using the Unity game engine. Oh yeah, and we're going to do it in under 10 minutes. This video is intended for people who are curious about how video games are made. It's a quick, uncut, and hopefully fun example demonstrating the general idea behind making a game and implementing key features such as responding...
I'm making a MOBILE GAME | Indie Game Devlog #0
Переглядів 1,6 тис.3 роки тому
About 3 years ago, I started work on a mobile game called Ultimate Battle Arena using the Unity game engine. In this video, I introduce the game and discuss my journey from an empty game scene to a full fledged project and back to a nearly empty game scene. I’ll share my struggle with nearly every aspect of game development: programming, design, art, graphics, and more. Ultimate Battle Arena is...
Hey very nice, you helped me a lot. And motivated me :) Cool video 👍
Solid tips for beginner trying to get more serious with coding in unity. Great video!
Rarely wish a video was longer but this is one. Well done.
As a professional software developer let me say #2 Comments when you said "Use them frugally" made me very sad. Document everything brothers. More is better than less I promise. If your game pops off and some other company wants to port it they will thank you.
great video i use those tips in my big unity project
SerializeField gang!
After watching this video, I kinda regret doing composition over inheritance
Not naming variables "yourmom" is an advanced tip? 😂
So, this video basically summarizes like 80% of what I learned getting a degree in Software Engineering/Real Time Systems. Obviously lacks depth (how could you in a 22 min video) but is an amazing resource.
why do you look like you hate the day you born
You can use Invoke with the actual function itself, not just the string name. This helps prevent typos and lets you refactor more easily
I had to give a like to this good hearted gentleman for sharing this treasures with us 🥹❤👍
for breaking a big function into multiple smaller functions, should put those smaller functions in the big function, unless they are being shared by other function in the class, so u can easily know those smaller functions only work in that scope of that big function.
i have a noob naming method, all functions start with fct, all integer variables start with int, all string variables start with str, etc. so i dont have to remember all the variable name, i just need to remember their type, when i need to use them, when type int, fct, or str ... autocomplete(or intellisense) will give me a list to choose from. works well until there are too many variables or functions in the same scope, then i will start to split code into different scope.
As someone with a few years of professional dev experience, I still use "yourmom" as a variable name in prototyping. I've actually used it more and more over time.
Half the time my debugs return "minou" (Kitty in french) or something equally stupid, and I'll call my variables stuff like that too if I'm only trying to get a hang of the conceptual logic for the code.
Thank you so much for this video bro! 💛
This is awsome! Many cool things.
ScriptableObjects were introduced in Unity 3.5, which was released in 2012. This feature has since become a powerful tool for managing data and creating modular systems in Unity, allowing developers to store data outside of scene files and reduce dependencies between game components.
Another tip: When using Invoke, instead of writing the func name yourself, use nameOf(MethodName), that way you will get an error if you misspell the method name.
So much great info here! Perfect!
Great video! Just a tip, do not use == to compare null as it can be overloaded. Use "is null" or "is not null"
"fortunately, Unity RECENTLY released a feature called scriptable objects." Scriptable objects were released TWO YEARS prior to this video... How is that _recent_
This video made me feel so much better about the things I have been confused about at school, thank you so much for putting this together.
don't pass the coroutine name as a string literal: pass it as nameof(YourCoroutineName) so that it's checked by the compiler and the method can be refactored later if needed
1:59, talking about consistency while showing 3 different naming conventions in the same class
I only see 2 TBF!
@@radiofloyd2359 move_speed (snake case), rotationSpeed (camel case), IndicatorHeight (pascal case)
I'm not actively using Unity at the moment, but a lot of these are solid pieces of advice for programming in general.
Okay Wasn't what I was looking for but this was super helpful. I was wondering if you could make a video on just better "coding methods" like showing us how to apply recursion in unity instead of loops. I know recursion because I took a course it for college but I totally forgot the rest of my C++ course so yea.
The last tip 21:05 I learnt it the hard way 😅 For those who didn't experience it yet, take it very serious, it'll save a lot of time and nerves 😁
what are the font that you are using in the code editor? Seems so nice, clean
Consolas
Not only useful for unity but just in general
Tip If your naming conventions are okay and you still need to explain what your code is doing .... you are doing it wrong. (whatever it is)
Video's great but this is very beginner Coding tips, half topics are covered in Unity dev introduction course and the other half is basic dev/OOP knowledge without going too much into it. Advanced, especially for big projects, would be dependancy injection, code architectures with pros/cons & how to mix and mash and use the best of them in Unity, Unit testing, Memory Usage, Pooling, etc..
Lots of good advice here. The main omission from my perspective is unit tests. Increase stability and make changes quickly and safely by covering your code with tests :)
Man what amazing engineering job you made explaining your bot system in such richness of details. Thank you, this is a really valuable content ❤
This was awesome! Thank you for this great information.
Some of this advice is very bad and inapplicable to big projects! Using Singletons all over the project will make your code unreadable and unrefactorable, because everything will reference everything, and you won't even be able to see all the dependencies in one place, as they will be spread all over a file. Use DI container instead. Same with UnityEvents, it's easy to just assign a method to the event in the Inspector when you are the one person working on a project, but if you are in a team of developers and you will have a conflict in this prefab, you'll likely just miss this event and everything will break. It's always preferable and easier for developers to link the events in code. Deep layers of Inheritance is also not very good, composition is better instead.
I don't think he ever suggested deep inheritance, though. I think weapon - gun / melee - specificWeapon is a reasonable inheritance chain. We're not talking about that many layers of inheritance.
starting Unity and will follow your tips.
Your weapon code probbaly would fit beter as components not sub classes.
VERY GOOD VIDEO. Thanks for all the effort putting it together. Great stuff. :D
you made a great video here. 😀
4:55 Hold alt in your IDE to select multiple lines of code at a time. Very useful!
i really like this vid, he really helped me get into the mindset of developing a big project and even made it seem a little less daunting by splitting things up and haveing your code correlate with itself, thanks
1 more tip for whoever needs to hear it: Stop watching UA-cam videos about how to do stuff and go try to do it yourself! You'll learn best by doing.
Damn. Sage programming advice from a young programmer. This guy is going places.
Really good video! One additional thing that I like to have as a standard when using strings for Invoking or Coroutines is to use the built-in "nameof()" function so the editor can identify the references.
These are great tips. I recently cleaned up a project significantly just by drawing a box for each script in my project on a piece of paper and drawing an arrow from each box to each box it referenced. I realized i had tons of messy and unnecessary references all over the place and was able to delete almost half of all the code I had written as well as delete an entire class that turned out to be unnecessary.
On the Action class for your event, why did you not use the event keyword?
I feel like you can generate a navMesh with colliders. Its somewhere in the navMesh settings
What's great about this video is many of these tips apply to almost all software. I wish some of my coworkers would watch this lmao
For my project to come to a grinding halt first it needs to come to a grinding start.