The Unity Tutorial For Complete Beginners

3,226,758
1,230
Published 2022-12-02
🔴 Get bonus content by supporting Game Maker’s Toolkit - gamemakerstoolkit.com/support/ 🔴

Unity is an amazingly powerful game engine - but it can be hard to learn. Especially if you find tutorials hard to follow and prefer to learn by doing. If that sounds like you then this tutorial will get you acquainted with the basics - and then give you some goals to learn the rest by yourself.

The tutorial covers everything from installing Unity, to writing your first ever line of programming code, to creating UI, to building an executable game file you can share with friends. No experience is needed.

=== Files and Downloads ===

Assets - www.dropbox.com/sh/h5vez7ltgbmfnib/AADSCiI2dEKptcR…

Scripts - pastebin.com/QiLkpeJe

Unity Project - github.com/Britishgaming/GMTK-Unity-Tutorial

=== Sources and Resources ===

(1) Time.deltaTime - docs.unity3d.com/ScriptReference/Time-deltaTime.ht…

(2) Instantiating Prefabs at run time - docs.unity3d.com/Manual/InstantiatingPrefabs.html

(3) Object.Destroy - docs.unity3d.com/ScriptReference/Object.Destroy.ht…

(4) Debug - docs.unity3d.com/ScriptReference/Debug.html

(5) ContextMenu - docs.unity3d.com/ScriptReference/ContextMenu.html

(6) OnTriggerEnter2D - docs.unity3d.com/ScriptReference/MonoBehaviour.OnT…

(7) GameObject.FindWithTag - docs.unity3d.com/ScriptReference/GameObject.FindWi…

(8) GameObject.GetComponent - docs.unity3d.com/ScriptReference/GameObject.GetCom…

(9) OnCollisionEnter2D - docs.unity3d.com/ScriptReference/MonoBehaviour.OnC…

(10) AudioSource - docs.unity3d.com/ScriptReference/AudioSource.html

(11) PlayerPrefs - docs.unity3d.com/ScriptReference/PlayerPrefs.html

Recommended Videos and Channels

Brackeys - youtube.com/@Brackeys
Tarodev - youtube.com/@Tarodev
Game Dev Guide - youtube.com/@GameDevGuide
Samyam (Best New Input System Tutorials) - youtube.com/@samyam
Learn C# with these 9 lines of code -    • Learn C# with these 9 LINES OF CODE -...  

=== Chapters ===

00:00 - Intro
02:26 - Installing Unity
03:42 - Step 1 - Unity UI
06:49 - Recap
07:11 - Step 2 - Physics and Programming
15:30 - Recap
16:09 - Step 3 - Spawning Objects
27:52 - Recap
28:32 - Step 4 - Logic and UI
37:12 - Recap
38:00 - Step 5 - Game Over
43:31 - Next Steps

=== Credits ===

Music provided by Epidemic Sound - www.epidemicsound.com/referral/vtdu5y (Referral Link)

=== Subtitles ===

Contribute translated subtitles - amara.org/videos/SsFnt050CEaU/

All Comments (21)
  • @GMTK
    If Visual Studio is not automatically suggesting code for Unity, please follow these steps: In Unity, go to Edit - Preferences. Under External Tools, pick Visual Studio from the "External Script Editor" dropdown.  Then completely shut Visual Studio, and open it again by double clicking a script in Unity. It should now suggest code as you type!
  • @fallbranch
    Jeez. I just burst out laughing. I added physics. You said the bird will fall down, but instead it floated up like a balloon. Turns out I added physics to my camera, and it fell off the stage,
  • @HyperAnimated
    This is hands down one of the best tutorials on anything, ever, that I have ever watched. It's clear, understandable, well paced, and after 18 years of programming in Adventure Game Studio, taught me new things not just about programming, but about how to think about programming. No exaggeration - it's been a rough few days for me. I suffer from severe depression and a lot of it is centered around creativity. I was preparing to give up on Unity entirely today, decided to try one more time to find a tutorial that wasn't confusing or that failed to work the way the creator said it did, and finally found yours. I've gone from wanting to cry to doing dances in my chair as I learned new things. I even accidentally broke something midway through and was able to figure out how to fix it using the things you taught me. THANK YOU. So much. I'm going to include a dedication to you and this tutorial in my first Unity game release.
  • @bonbopluh
    I watched this about 7 months ago and I've improved so much, I went from this to actually getting a steam page for one of my games, and I couldn't be more grateful for this tutorial, Ngl I be lost without it
  • I'm a school teacher that uses Unity for our game dev class. This is possibly the best introductory tutorial I have ever seen. All the fundamentals covered in a short, easy to understand manner that gives a learner a viable end product to show off, and ideas for further development and learning. Amazing work Mark. EDIT - 06/02/2023 - WIll be using this tutorial as part of a Unity introduction for my game dev class, will report back how the students go with it! EDIT 12/07/2023 Did a survey with the students at the end of course, asked about this video tutorial, here are the results Average rating out of 5 (rather unscientific question) - 4.13 What the students said: It was very fun and exciting to see a game which you coded work. Straight forward and helpful for clueless beginners. The tutorial is very clear and easy to follow Straight forward and very helpful. It was easy to listen to, no overcomplicated steps and enjoyable to do. thought I wasn't here for most bit, he could of have been more specific about certain settings and what we were meant to do (not shown in the video) Nice voice and good for beginners. Very organized and it a great transcendence Easy to understand and follow. Good experience to learn more about game programmings. It's detail and easy to understand I think its pace and information is good for beginners for their unfamiliarity with coding It was pretty good, the only thing that kind of threw me off was his strong accent. Excellent pacing which gave the time for you to work on it, and took the time to explain the purpose of each function straight forward and easy to understand and complete It very gud it was simple and good It was good for a starting tutorial for flappy bird. the tutorial was good, but there was a lot that had to be explained outside it. Should have more explaining on the code. It's long but it helps you understand a lot of stuff
  • Really great overview of the basics coupled with the usual excellent editing! Nice! Some more advanced concepts for anyone who wants to keep learning to the next level: - Naming Rules: They can be whatever you want, as long as you are consistent. Unity already uses PascalCase for functions so you should write your own functions with PascalCase as well in order to avoid Start, Update with one naming rule and custom functions with another. - Magic Numbers: Using numbers directly in the code can make it really tricky to remember what they mean when you return to the code after a few weeks. For example at 12:15, what does that "10" mean? As you are writing the code obviously you know what it means, but you will forget that meaning after some time. So instead of using magic numbers you should always give it a proper descriptive variable name. If you just use the value in that one place you can make it a local variable. You can see the huge difference with regards to code readability once Mark changes it to a variable, the code is much easier to understand. When you come back to that code 1 month from now there's no need to remember what "10" meant since it uses a proper variable name that clearly explains what it does. More info on Magic Numbers: https://youtube.com/watch?v=CQ5xHgRZGQo - Making everything public: When you make something public you are allowing that field to be both read and written to from anywhere in your entire codebase. For example at 11:08 the Rigidbody is public but you don't want another random class to randomly modify that field. If you had another script that set that field to null while the game was running then everything would break. With the field set as public there is nothing to stop that from happening. So the better approach is to make it private, that way only that class can read and write to that field, no other class can modify it in any way. Good programming is all about minimizing complexity, the more you limit how accessible something is the easier it is to understand, you don't need to keep in mind your entire codebase since only the code in that class can read or write that field. So in that case you have two better options, you can make it private, but then you can't drag the reference in the inspector. Since the Rigidbody is on the same object you can grab the reference with GetComponent<Rigidbody>(); that's one approach. Another approach is make it private but add the attribute [SerializeField] this lets you make a field private so it's not accessible from any other class but it is accessible from the Unity editor. So with that you can drag the reference in the editor directly. More info on why you should NOT make everything public https://www.youtube.com/watch?v=pD27YuJG3L8 - Tags: They are strings and Strings are very error prone so you should really not use them, if you write "logic" instead of "Logic" it will break, if you write "Logic " it will break, "Iogic" "L0gic", etc. Just looking at it they all look correct and the code doesn't give off any errors, but when you run the game everything will break and it will cause you a lot of headaches. Instead of Tags either drag the reference directly or use the Singleton pattern. More on why you should avoid strings: https://www.youtube.com/watch?v=Q8n1uFTG97s - Updating UI State: As I mentioned the main goal with good programming is minimizing complexity. In order to do that one of the best concepts is decoupling. You want your scripts to be as separated from everything else as possible, you want to limit interconnections as much as you can. So for example for updating the UI, 35:35 you should not have the Pipe Logic class tell the UI class what to do, that way the scripts are tightly coupled. If you remove the UI from the project everything will break because the Logic class expects the UI to exist. One excellent C# feature that really helps solve this are Events. This is how you can define an event, like OnPassedPipe which you could define on the Bird class, and then you fire that event whenever you want. Then some other class, like the UI class, can listen to that event and do whatever logic it wants, like updating the score text. That way the UI class would be completely decoupled from the Bird class. You could remove the UI and the code would still compile because they are not directly connected. Same thing for the GameOver logic, the Bird should fire off some kind of OnDead event which the GameOverScreen would listen to and show itself. Here's some more info on C# Events https://www.youtube.com/watch?v=OuZrhykVytg - Text: Unity has two Text systems (which itself has two components for both UI and World) Mark mentioned it at 43:21 how the Text used in the video is the Legacy text which is extremely limited so nowadays you should instead use TextMeshPro In the code, instead of using UnityEngine.UI; you use using TMPro; For the field instead of Text you would use TextMeshProUGUI for UI Text and TextMeshPro for World text. - Input: With regards to Input, the new Input System is indeed much more capable but for learning and quickly making something using the legacy Input Manager is still an excellent option, it's what I use when I'm just making a prototype since it's very easy to use. If you want to learn more about the new Input System I covered it here https://www.youtube.com/watch?v=Yjee_e4fICc - Render Pipelines: Mark quickly selected the 2D template and started making the game, this template uses what is called the Built-in Render Pipeline This is the render pipeline that Unity has had for years, it works great but nowadays you have two other options HDRP or the High Definition Render Pipeline which is the render pipeline you want to use if your game is pushing visuals to their limit. URP or the Universal Render Pipeline, this is the option you should probably be using nowadays, you have many more features like 2D lights, Shader Graph, etc. There are other Templates that you can download which come with the Render Pipeline already set up. In most cases nowadays you should be using URP, it's what I always use in my videos and its what I'm using in my upcoming Steam game Total World Liberation https://www.youtube.com/watch?v=6DGDWfPdn3w - Unity Versions: In the beginning Mark downloaded the version that was automatically selected which is indeed the one you should be using, but if you search you might see some more versions, here's how they are organized. You have TECH, these are the more recent versions, right now it would be 2022.1, you should only use these when you have a specific feature you want to play around with that only exists in this version, or if you're making a game that is 1+ years away from release. ALPHA, BETA, as the name implies these are the upcoming versions and are not guaranteed to be extremely stable, so only use these when trying something on the bleeding edge. For 99% of cases you should use the version it automatically selects which is the LTS or Long Term Support version. So right now you should be using 2021.3 LTS, and in about 6 months you can use 2022.3 LTS More on Unity versions https://www.youtube.com/watch?v=LLYhTWEX2Wc Great job with the video! I'm sure this will help tons of people on their game dev journey!
  • @radicaltophatguy
    Honestly, this is what programming tutorials should be. A simple step-by-step video, split into chapters, and explained using recognizable visuals and representations. Keep up the amazing work!
  • This is a beautiful way of giving an overview of the engine without delving too deep into the concepts. It touches the basics but isn't too long that it leads to boredom. Thank you very much for this wonderful video.
  • @fneifneox64
    Thank you so much Mark. I watched this about 6 months ago and now I code games in Unity. I would have never started to make games. Recently I watched your videos about Mind over Magnet and I love how you present your work. It's amazing and I really appreciate that you helped me to build my own games.
  • I've been learning for 2 years now, but I still like to come back to videos like this take some pride in knowing I've passed all these hurdles. If you are reading this and just starting out, keep pushing forward and you will be rewarded in the future.
  • quick tip: you probably don't want to set variables to public just to see them in the inspector (that creates a danger that you unintentionally change them somewhere else in the code). A much better practice is to prefix private variables you want to expose to the inspector with "[SerializeField]"
  • I cannot express how much this was important to me. Was looking on every video that I could find, but no one was so good as you were to explain the basics of Unity this well. Really, thank you my man!!
  • @BeBlessedGames
    This is SO cool. If you play around with similar stuff then build and learn...you'll eventually be able to do. Don't doubt yourself. Keep learning and doing.
  • You are an amazing educator. Being able to teach this much, in such a pedagogical way, in barely 40 minutes, is something worth admiring. Thank you for being you, ❤
  • @Chodor101
    Youtube gods decided that I shall watch this, who am I a mere mortal to judge their decision.
  • @NikErnesto
    this is the one and only game design video that was easy to follow and educational, I hated watching videos where people wrote code without explaining what the word did, you did an excellent job. If anyone around me ever wants to start I will send them here and only here
  • This was absolutely incredible, everything I was looking for in a tutorial. Thanks so much!
  • @Luke_Dude200
    I don't know if I'll ever use this tutorial but I really love how this channel has been getting into making games and helping other people with that journey as well
  • As a gamedev myself, gotta say this is near perfection. Mark was able to compress hours of tutorials in a solid, nicely formatted, 40 minutes of pure and useful information. Got the perfect balance between just glimpsing all of Unity's potential and also presenting lots of content and quirks that only experienced people will get. My advice for those who want to get into this world would be to follow the steps as Mark describes them, side by side in your PC. That's the best way to actually learn. And as a few concepts he presented are a bit harder to get, would be a good idea to rewatch the video as you go in the learning process. That will show you how much you did evolve. As always, great video, Mark! Thank you!
  • @user-nv3xi8mz7u
    thoroughly impressed with your introduction to not only Unity but basic coding as well! great job man, this was massively helpful