How to make a Video Game in Unity - COLLISION (E05)

Sdílet
Vložit
  • čas přidán 25. 07. 2024
  • What happens when stuff collides? Let's take a look!
    ● Download the Project Files: devassets.com/assets/how-to-ma...
    ❤️ Donate: www.paypal.com/donate/?hosted...
    ····················································································
    This video is part of a mini-series on making your first game in Unity.
    ····················································································
    ► Join Discord: / discord
    ♥ Subscribe: bit.ly/1kMekJV
    ● Website: brackeys.com/
    ● Facebook: / brackeys
    ● Twitter: / brackeystweet
    ········································­­·······································­·­····
    ► All content by Brackeys is 100% free. I believe that education should be available for everyone. Any support is truly appreciated so I can keep on making the content free of charge.
    ········································­­·······································­·­····
    ♪ Baby Plays Electro Games
    teknoaxe.com/cgi-bin/link_code...

Komentáře • 3,8K

  • @blyatman3798
    @blyatman3798 Před 5 lety +3788

    Anyone notice how as the series goes on there is less and less views because people give up but great videos I love them

    • @jonatan01i
      @jonatan01i Před 5 lety +166

      It's like with any other series.

    • @ketsuenightcore
      @ketsuenightcore Před 5 lety +51

      I don't even know why I'm following this series

    • @whimsical2223
      @whimsical2223 Před 5 lety +38

      if you a have a bit of programming experince this is actually that hard

    • @RoboEpic
      @RoboEpic Před 5 lety +7

      that's what i noticed

    • @otfast2228
      @otfast2228 Před 5 lety +35

      that'ts a big mistake don't give up! You need to have fun programming.

  • @davidslivnyak4866
    @davidslivnyak4866 Před 4 lety +1093

    Hope this series booms during quarantine!

    • @chickeninabox
      @chickeninabox Před 4 lety +29

      It did.

    • @aw1lt
      @aw1lt Před 4 lety +6

      mhm, it definateley did

    • @ImmortalRemy
      @ImmortalRemy Před 4 lety +19

      I was like hmm I should really start lerning how to use unity.. TIME FOR LATE NIGHT CODING BOI'S!

    • @oakleyblade9400
      @oakleyblade9400 Před 4 lety +2

      yah... i've gotten here in .5 days cuz of all the time on my hands!

    • @IsaacMcC
      @IsaacMcC Před 4 lety +1

      did u get this to work, I haven't been able to and I'm totally stuck

  • @Eric_Shaun
    @Eric_Shaun Před 3 lety +86

    After thinking and being "scared" of starting learning coding and trying to create a game, I started yesterday and downloaded unity - and so far i am having a blast and thats thanks to you, brackeys
    wonderful tutorials so far, great explenations, and perfect "from scratch" tutorial/lessons.
    I have done a Tutorial, ,besides the "microgame" from unity, but that was way to "specialized" and adding to an existing project, which still did not cover the real basics of unity.
    much love!

  • @tylerwalking392
    @tylerwalking392 Před 4 lety +445

    Hey, anyone who sees this and you're thinking about giving up, DON'T. You are halfway through and it gets easier and more fun from here. I promise all of the hard work pays off.

    • @ZaymsMarbleRaces
      @ZaymsMarbleRaces Před 3 lety +23

      I saw this at the perfect time ;)

    • @simeonstoilov9576
      @simeonstoilov9576 Před 3 lety +1

      omg this takes a lot of time

    • @mr.mystical9776
      @mr.mystical9776 Před 3 lety +2

      Yeah, your right, and when you finish here til now (like i am) i kinda figured how to write some code for myself!

    • @latrys886
      @latrys886 Před 3 lety +3

      @@mr.mystical9776 Omg thank you so much. I want to end but you gave me the power to do it and i did it

    • @mr.mystical9776
      @mr.mystical9776 Před 3 lety +1

      @@latrys886 Your welcome!

  • @CurbStompCity
    @CurbStompCity Před 7 lety +93

    I just want to quickly comment whilst in the middle of this playlist. Attempting coding has always been a daunting task, but your videos explain everything really well and it is slowly becoming a lot more clearer to me. Thanks. :)

  • @DavidPalayathar
    @DavidPalayathar Před rokem +33

    For those who are wondering on how to get the collision system to work, I found out how to fix it,
    The code:
    using UnityEngine;
    public class PlayerController : MonoBehaviour
    {
    public PlayerMovement movement;
    void OnCollisionEnter(UnityEngine.Collision collisionInfo)
    {
    // Check if the player collides with another object
    if (collisionInfo.gameObject.CompareTag("Obstacle"))
    {
    movement.enabled = false;
    }
    }
    }
    Make sure you remember to link the PlayerMovement script to this script through unity, in the inspector.
    I hope you've found this helpful🙂

  • @twwister98
    @twwister98 Před 3 lety +51

    Just want to say a shout out for Brackeys being so happy every video! It's cool to see someone so happy about passing on their skills to others! #Hero

  • @kailange-dei7785
    @kailange-dei7785 Před 4 lety +93

    for anyone having this problem if the error shows up and says null reference exception that mean that you have to drag player movement into the collision scrip that's what worked for me. the part I missed was at 7:03

    • @TheNewYouTubeHandlesAreDumb
      @TheNewYouTubeHandlesAreDumb Před 4 lety +3

      Ahaaaa thank you

    • @shakedcohen5036
      @shakedcohen5036 Před 4 lety +1

      thx!!

    • @thesunshineart9876
      @thesunshineart9876 Před 3 lety +1

      kai Lange-dei thanks brooooo I can’t thank you enough

    • @BreeingIan
      @BreeingIan Před 3 lety +3

      Thanks so much I almost gave up until I saw this. So frustrating but incredibly rewarding once you finally figure out what's wrong

    • @anexotikbakka2342
      @anexotikbakka2342 Před 3 lety +2

      @@BreeingIan hey pls help can u elaborate more im rly smol brain so cudnt understadn hv same error tho

  • @CobbleTrash
    @CobbleTrash Před 6 lety +32

    You look like the happiest man I’ve ever seen all the time, I love it

  • @MKx2_05
    @MKx2_05 Před 2 lety +5

    anyone realise that all the ads he does are to help the comunity not for personal gain
    this is how to distinguish good content creators from the bad ones.
    true legend.

  • @brucelee7782
    @brucelee7782 Před 3 lety +4

    I like how he explains things step by step. I mean REALLY step by step. For exmaple I didn't what the tag was for in other tutorials, they just glanced over it but this guy really explains things. Now I have a better solid understanding of unity.

  • @kaperfairt2076
    @kaperfairt2076 Před 4 lety +3

    Thanks. This is the tutorial series i've been looking for a long time. You explain everything clearly and smoothly. You've earned a subscriber.

  • @ralf6756
    @ralf6756 Před 5 lety +4

    he explains things fast into the point directly and keeps everything simple , can't imagine something better

  • @vladymartinez1232
    @vladymartinez1232 Před 5 lety +319

    I just discovered a world i love and i didnt know, i guess i will have to change my major😂, btw im doing everything exactly as he is doing it but i have so many different ideas for it but i dont know how to execute them, i guess i have to stick to what he is doing till i actually learn

    • @on3x903
      @on3x903 Před 5 lety +48

      Thats what i am doing. I think we need to just copy him, and after learning it, we can advance our self, because then we have a lot more experience we can use to put something together, tyhen it gets easier to watch harder turtoials

    • @suhailseedat523
      @suhailseedat523 Před 5 lety +9

      Keep on moving bro and you'll succeed

    • @TecBratGames
      @TecBratGames Před 4 lety +8

      Duplicate a scene to give yourself a playground of sorts and hack away at it. Google whatever you don't know. Then, come back to Brackeys for more of these amazing vids!

    • @desirocker9099
      @desirocker9099 Před 4 lety +2

      check out Unity c# documentation

    • @taem3542
      @taem3542 Před 4 lety +2

      I am also doing this I have an idea to make a sorta 3d version on the no internet dinosaur game it's likely been done already but I just want to do it myself to share with friends

  • @alessio5713
    @alessio5713 Před 2 lety +3

    i love how the videos are short and straight to the point like small baby steps

  • @thilosaur2169
    @thilosaur2169 Před 4 lety +6

    I've been using this tutorial to make my first ever game in unity in like one night and its going great!

  • @pinkiepurplez
    @pinkiepurplez Před 4 lety +5

    Good job to those who have kept going through the tutorial. You are a true champ, and I hope to see you watch the next one. Don't lose motivation.

  • @imperfect_cliche
    @imperfect_cliche Před 7 lety +3

    these videos are awesome. Been learning a bunch of new languages over the past few months and this is actually helping me with c# as well. It is so cool because I always wanted to get into game development. Still at novice level but it has been so fun learning all these new things both in my classes and on your channel and many other channels. Thank you for the videos!

  • @skypirate97
    @skypirate97 Před 3 lety +340

    When you spell Obstacle "Obstacal" accidentally in the code and it takes you half an hour to figure out that fault:
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

    • @THEspindoctor84
      @THEspindoctor84 Před 3 lety +5

      hey, I bet that moment when you finally realized your mistake felt GREAT!

    • @emoshimo9332
      @emoshimo9332 Před 3 lety +1

      @@THEspindoctor84 i started this tutorial series 2 days ago and dont have any other coding exp is it normal that i dont understand the codes but just copying them seeing results for now

    • @THEspindoctor84
      @THEspindoctor84 Před 3 lety +9

      @@emoshimo9332 I'm not an expert, but I would definitely say that that is normal. But starting here seems a little bit advanced for someone with literally no coding experience. Its generally not good to just copy code and see the result, without understanding the concepts. I would start with a nice long FreeCodeCamp video, like this one on C#. czcams.com/video/GhQdlIFylQ8/video.html
      Once you watch that, you will understand some of the basic syntax, and this might make more sense. I also recommend books, since I believe they tend to explain concepts better than videos. I am currently using "Learning C# by Developing Games With Unity 2020" by Harrison Ferrone. Its very good for someone with little or no coding experience.

    • @emoshimo9332
      @emoshimo9332 Před 3 lety +4

      @@THEspindoctor84 thanks sir that will help a lot i really appreciate your time and effort i can say you made my day :)

    • @IbraHere
      @IbraHere Před 3 lety +1

      Lmao

  • @a-tech5452
    @a-tech5452 Před 3 lety

    I made a speed ramp using the information from this video. My game is starting to come together. Thank you for giving amazing free tutorials!

  • @dratylapio
    @dratylapio Před 4 lety +7

    this mans intros are the happiest things ive seen in my entire life

  • @Antonfwp
    @Antonfwp Před 4 lety +3

    I am so thankful for this video series!!
    This is just so great i already learned so much and also feel like i really understood it to a level where i am able to program my own little games and they actually work :) i am so happy

  • @migcraft5072
    @migcraft5072 Před 2 lety +1

    still helping and relevant 4 years later thank you!

  • @aprilea81
    @aprilea81 Před 2 lety +1

    Got unity 2 days ago and Brackeys is making it easy to learn c # and game design. thx Brackeys

  • @interflashz
    @interflashz Před 7 lety +195

    Please make longer episodes when you come back from your vacation, I hope you have fun!

    • @AnasMations
      @AnasMations Před 7 lety +4

      Inter Flash yeah it's too short

    • @RitobanRoyChowdhury
      @RitobanRoyChowdhury Před 7 lety +5

      Longer and Advanced tutorials, Please!!

    • @RitobanRoyChowdhury
      @RitobanRoyChowdhury Před 7 lety +4

      I never said to get rid of these short ones, I just said I'd like to see longer and more advanced ones. Maybe some kind of procedural (dungeon, world, quest, etc) generation?

    • @RBTGamming
      @RBTGamming Před 7 lety +8

      it's for people who are scared by longer videos, like me. I like this piece meal method. I believe have other videos that are longer (not sure though).

    • @AnasMations
      @AnasMations Před 7 lety +1

      Royal Tyger's Media but he makes one video of this series once per week so the solution is to make more videos or make the video longer (sorry for my bad English)

  • @eeshionglim6360
    @eeshionglim6360 Před 3 lety +24

    Hi Guys,
    For those player who are unable to stop after the collision, you may refer to 5:43.
    Check the tag for all of the "obstacle" whether is it the same on your scripts.
    Hope this might help you guys!
    Have a nice day :)

  • @gamergrape0914
    @gamergrape0914 Před rokem

    This series aspires me so much to go forward in game design thank you ❤

  • @gamevader
    @gamevader Před 4 lety

    I'm so grateful for this series!

  • @muhammadrizwanhameed2223
    @muhammadrizwanhameed2223 Před 4 lety +5

    This series is becoming Addicitive!

  • @Holladawg
    @Holladawg Před 4 lety +97

    * yellow cube hits black cube *
    "Houston, we have a problem"

    • @dio1647
      @dio1647 Před 4 lety +11

      You sir, are colorblind

    • @Holladawg
      @Holladawg Před 4 lety +7

      @@dio1647 i just colored mine different

    • @hioman
      @hioman Před 3 lety

      Wow, that's exactly how I colored mine

    • @mitaka_78
      @mitaka_78 Před 3 lety

      I dont understand

    • @sabana7564
      @sabana7564 Před 3 lety

      Okay thats so wierd I put the exact same text as mine as well!

  • @vanshpahuja2064
    @vanshpahuja2064 Před 3 lety

    Thank you for all your tutorials, they are very helpful.

  • @aryankhandelwal37
    @aryankhandelwal37 Před 4 lety

    Your series is awesome dude I will watch each video of yours atleast 2 times and then will move towards making a basic game due to which I started learning unity and it was a little difficult to make in frameworks like flutter flame which I was recently using

  • @renovski8992
    @renovski8992 Před 5 lety +4

    i love this channel. thank you for these amazing tutorials

  • @nichobeastmode8361
    @nichobeastmode8361 Před 6 lety +166

    Everyone who is having problems do this!!!
    Chang it from, void OnCollisionEnter (Collision collisionInfo) TO void OnCollisionEnter (UnityEngine.Collision collisionInfo) in your script

    • @vijaysaichowdekar5515
      @vijaysaichowdekar5515 Před 5 lety +10

      thank you sooooo muchhhh NichobeastMode i was stuck doing this for like 2 days and i was literally gonna stop this thing then i tried ur thing and it worked out
      thank you once again dude

    • @PigeonFoodmemes
      @PigeonFoodmemes Před 5 lety

      thank you

    • @Seafoodmon8
      @Seafoodmon8 Před 5 lety +6

      I was following one of his later videos and accidentally deleted my scripts so I had to rewrite them with all my objects and shit still there. Now whenever I try to write the collision script it won’t work any more even when I tried to change it to the way you said when it worked before. Im infuriated

    • @razvaniuga9164
      @razvaniuga9164 Před 5 lety +1

      Thank you so muchhhhhhhhhhhhhhhhhhhhhhhh

    • @zontiakofficial
      @zontiakofficial Před 5 lety

      Thank you!

  • @Marco-rv7ec
    @Marco-rv7ec Před 3 lety

    I started game development with this project, one year ago exactly. Meanwhile I made a 2D platformer game for my school project, and game development is what I love to do. Brackeys taught me the basics, and I can´t say thanks enough. Today I will finish this little cube game, because I want to work with 3D as well. Never give up people.

  • @jordanbentley
    @jordanbentley Před 8 měsíci +1

    this is actually so fun to just mess around in and learn, thanks so much! :)

  • @Pozivnoy_Haski
    @Pozivnoy_Haski Před 3 lety +36

    I'm from Ukrain and don't speak English but watching these videos I'm was amazed because I understood him very good, and I'm so grateful for your work (11 videos "How to make a Video Game"). Thank you man!!

    • @32141
      @32141 Před 3 lety +3

      Hi Am Russia Man XD

    • @prime_fn228
      @prime_fn228 Před 2 lety +2

      сало сало сало Українске сало

    • @thomasviglione2362
      @thomasviglione2362 Před 2 lety

    • @digviaysingh480
      @digviaysingh480 Před 2 lety

      Then how did you wrote this comment..?

    • @Pozivnoy_Haski
      @Pozivnoy_Haski Před 2 lety

      @@digviaysingh480 I wrote this comment whith "Google translate" and I'm know English, but some bad for free understand these videos.

  • @blsbros8269
    @blsbros8269 Před 2 lety +3

    i will comment every year on this video and share my game dev experince
    2022---
    i am new in unity trying to learn 2d games

  • @jonathandevine504
    @jonathandevine504 Před 4 lety

    Yo man fantastic tutorials they are so informative and I just love them so much!

  • @Rehan-sh3xu
    @Rehan-sh3xu Před 3 lety +1

    I am loving ur series ik it is old but really its amazing!

  • @_zerohour_
    @_zerohour_ Před rokem +14

    This is my third time coming back to Unity, and honestly, I'm astonished at how simple this stuff is in hindsight. I have experience in the kids coding site called Scratch, and frankly it's making this so much easier to digest. I mean, I really get this stuff, and I'm feeling so confident in it so far!! I think the best part for me to, is I have an understanding I don't know that much, and due to this, I got a good grasp on how big my scope is... But! I'm confident I can do something that'll be just fine! I'm just so happy for this tutorial, thank you, Brackeys!!!

    • @masterjokerx549
      @masterjokerx549 Před rokem

      Did everything come out well for you??? Because it didn’t for me it had so many problems in this part and now i just messed up all the old parts 😢

    • @_zerohour_
      @_zerohour_ Před rokem

      @@masterjokerx549 What's the problems you had? I can do my best to help!

    • @masterjokerx549
      @masterjokerx549 Před rokem

      @@_zerohour_ omg you answered even tho your comment is 6 months old

    • @masterjokerx549
      @masterjokerx549 Před rokem

      @@_zerohour_ i kind of figured out the problem and it was that i don’t have a dotnet which i don’t know what that is since I’m new and after downloading multiple dotnets in unity itself as extensions and outside of unity i still have the same problem so it didn’t fix anything

    • @masterjokerx549
      @masterjokerx549 Před rokem

      @@_zerohour_ i had the player movement script functioning normally until i added the player collision script and the it started popping up and saying that my player movement script isn’t valid

  • @legosol1081
    @legosol1081 Před rokem +7

    Thank you so much, this series is great!

  • @mr.mystical9776
    @mr.mystical9776 Před 3 lety

    Awesome tutorials! With the script i learned how to turn of gravity to make it almost seem like the crash is in slow mo!

  • @simplerobloxstudio
    @simplerobloxstudio Před 2 lety +1

    funny how Brackeys have literal free tutorials on unity and other things have like 300 per year, keep up the great work Brackeys!

  • @jdgoldvox
    @jdgoldvox Před 4 lety +48

    To anybody who thinks that their player is "stuck" as soon as it hits the ground.
    I just fixed my code by making sure the semicolon ( ; ) is in the correct place. I axidentally put it after : if (collisionInfo.collider.tag == "Obstacle") ;

    • @memehut6342
      @memehut6342 Před 4 lety +3

      Thankyou so much

    • @mattiashenning7717
      @mattiashenning7717 Před 4 lety

      Helped a lot. Thanks mate

    • @Rangal25
      @Rangal25 Před 4 lety +1

      When I do that, it gives me a compile error, it won't work unless I have a semicolon there, so I don't know what to do

    • @SalopianYoutube
      @SalopianYoutube Před 4 lety +1

      Saved me time, thanks

    • @shreyashdurgapal4715
      @shreyashdurgapal4715 Před 3 lety

      Assets\Playercollisions.cs(5,8): error CS0246: The type or namespace name 'PlayerMovement' could not be found (are you missing a using directive or an assembly reference? how do i fix this please tell

  • @jovanmaric9837
    @jovanmaric9837 Před 3 lety +144

    "displaying a message in console isnt that exciting " *me cheering cuz it took me 2 days to do t properly*

    • @Prxojectmythic
      @Prxojectmythic Před 3 lety +1

      The same mine was working perfectly about 5 Kim’s ago but my unify is like broken cuz stuff never works for me and about 2 mins ago I was able to move and turn my cube and stuff like a game bug then I added the script for collision and it just stopped moving when I clicked play 😭I hate unity

  • @somerandomchannel_
    @somerandomchannel_ Před 3 lety +1

    these videos are really helpful, thank you so much for making them! :D

  • @projects9275
    @projects9275 Před 3 lety

    YOU ARE THE BEST CZcamsR! Too sad you no longer produce more content but thank you so much, I actually liked coding thanks to you so it is very inspiring :)

  • @marcellmeszaros9381
    @marcellmeszaros9381 Před 4 lety +10

    If anyone is having issues with the movement.enabled = false line, replace it with GetComponent().enabled = false;.

    • @danleavitt9589
      @danleavitt9589 Před 4 lety +3

      Thankyou so much

    • @loganmcghee2529
      @loganmcghee2529 Před 4 lety +1

      still not working, thanks for the help tho

    • @Nakasasama
      @Nakasasama Před 4 lety +1

      @@loganmcghee2529 Go into your slippery physics and change the values dynamic friction and static friction to 0.25. I had a problem where it clicked off but the movement didn't stop. It's possibly a physics problem that noobs like myself don't see. :-/ Took me an hour looking around to figure this one out. Anyhow, hope this helps.
      p.s. you do this in the Inspector window.

    • @mahindersingh3995
      @mahindersingh3995 Před 3 lety +1

      @@Nakasasama thx bro I am stuck on these error from last 4 days I am getting frustrated thx bro again

    • @vanillamusket5648
      @vanillamusket5648 Před 3 lety +1

      I've been trying to figure out how to fix this for days, thank you so much

  • @Arush299
    @Arush299 Před 4 lety +3

    The unity vid ever plz make more of these tutorial.
    its way better than udemy 300$ courses

  • @jihedbouchnak
    @jihedbouchnak Před rokem

    the best getting started tutorial ever in unity hope you came back one day or once a while

  • @matthewcollins9474
    @matthewcollins9474 Před 4 lety

    Thank you for your videos. You did a great job. You helped to so many people.

  • @rae-lloyd
    @rae-lloyd Před 3 lety +4

    brackeys: We hit an obstacle!
    me: AAAAA MY LEG

  • @classifiedinformation8686
    @classifiedinformation8686 Před 6 lety +36

    OMFG - idk if i should be so hyped but here are some comments saying it doesnt work blablabla...
    im an absolute beginner, and somehow - idk how in 15 minutes i made it work
    Also im happy to help, just copy and paste this!
    using UnityEngine;
    public class PlayerCollision : MonoBehaviour {
    public PlayerMovement movement;
    void OnCollisionEnter(Collision collisionInfo)
    {
    if (collisionInfo.collider.tag == "Obstacle")
    {
    movement.enabled = false;
    }
    }
    }

    • @akemidryzz9387
      @akemidryzz9387 Před 5 lety +1

      Oh dude thank you

    • @nathinoon
      @nathinoon Před 5 lety +4

      In my game there are these messages:
      The referenced script (Collision) on this Behaviour is missing!
      The referenced script on this Behaviour (Game Object 'Player') is missing!
      Can someone help me?

    • @akemidryzz9387
      @akemidryzz9387 Před 5 lety +1

      @@nathinoon Did you copy past the script of the guy right above?

    • @akemidryzz9387
      @akemidryzz9387 Před 5 lety +1

      @@nathinoon Oh and in your console, double click the error message, it can lead you where the error is

    • @akemidryzz9387
      @akemidryzz9387 Před 5 lety +1

      @@nathinoon and did you create the scripts and "put" them on the right thing? like for this one it s on the player

  • @ashsureshkumar9150
    @ashsureshkumar9150 Před 3 lety +1

    Dude you saved my life. I wanted to make games and stumbled upon this video I started and downloaded everything. But when it came to the first video i couldn't make the camera face the ground so i gave up and deleted unity. but 3 days later i downloaded it again an came back to your channel. And i finally figured it out. I just had to rotate it bro. And i'm still going on this and Thank you bro you're the best. ;)

  • @nostalgic8945
    @nostalgic8945 Před 4 lety

    Love it, hope i survive, its like my 10 attempt in unity and for first time i have done something and learnd, thank you

  • @xDerpygamer
    @xDerpygamer Před 4 lety +5

    Another tip for the people who are new to coding; make sure the void isn't a private void cause it'll for some reason suggest the "improvement" just do
    void OnCollisionEnter(UnityEngine.Collision collisionInfo)
    like everyone in the comments is saying

  • @Sofistar.
    @Sofistar. Před 4 lety +9

    Im a 10 yro Kid, and i imagened to create a game, i thought it was hard but with this, it is so much better! Thankyou!!!

  • @monkeydgoofy8074
    @monkeydgoofy8074 Před rokem

    it's so easy to follow along!
    Brackey you are a Legend!!!!!

  • @adrvapor9433
    @adrvapor9433 Před 4 lety

    i didn't think of disabling the script altogether, that's a pretty good idea! if all of the inputs regarding movement and interaction are in there, that's a great solution. i think i will do it the same way when i make my own game. thanks!

  • @Em-Fa
    @Em-Fa Před 2 lety +4

    I copied the code he wrote and i still dont get the collision info in console. Can someone please help?

  • @Xylz
    @Xylz Před 3 lety +16

    For anyone having it detect the ground as an obstacle,
    Make sure you dont have a semicolon here:
    public class PlayerCollision : MonoBehaviour
    {
    public PlayerMovement movement;
    void OnCollisionEnter (Collision collisionInfo)
    {

    if(collisionInfo.collider.tag == "Obstacle")

    • @LuxterVr
      @LuxterVr Před 2 lety +1

      thanks for the code for some reason my code wasn't working but I copied yours and it works now thanks man

    • @Xylz
      @Xylz Před 2 lety

      @@LuxterVr no problem!

    • @mpsclllion
      @mpsclllion Před 2 lety

      It won’t let me drag playermovement into movement

    • @rfb-playz3382
      @rfb-playz3382 Před rokem +1

      Thanks man.I have been stuck and searching for the solution for days and now it finally works.thanks alot

    • @OK-gz4wr
      @OK-gz4wr Před 11 měsíci +1

      You saved me. Thanks bro

  • @scratchtutorials1068
    @scratchtutorials1068 Před 3 lety

    we love you, you are the best teacher ever Brackeys!

  • @fahimimtiaz4532
    @fahimimtiaz4532 Před 3 lety

    You look so happy it's like you REALLY love this. I want that.

  • @willpunchit272
    @willpunchit272 Před 3 lety +5

    Brackeys: We're going to delete both the start AND the update method.
    *Wait, we're deleting all of it?*
    *Always were going to.*

  • @connorwill9916
    @connorwill9916 Před 4 lety +3

    For anyone confused on why you wont stop moving and get an error message as well possibly use this code (replase scr with your PlayerMovement script name, and also place playermovement script in collision script)
    using UnityEngine;
    public class PlayerCollision : MonoBehaviour
    {
    public scr movement; // A reference to our PlayerMovement script
    // This function runs when we hit another object.
    // We get information about the collision and call it "collisionInfo".
    void OnCollisionEnter(UnityEngine.Collision collisionInfo)
    {
    // We check if the object we collided with has a tag called "Obstacle".
    if (collisionInfo.gameObject.CompareTag("Obstacle"))
    {
    movement.enabled = false; // Disable the players movement.
    }
    }
    }

    • @AbusingEgo
      @AbusingEgo Před 2 lety +1

      OMG THANKS SO MUCH

    • @Ownxer
      @Ownxer Před 2 lety

      thank you! it didnt work for me and this saved me

  • @divieleischranjan3770

    Thank you for this amazing tutorial it is really fun working on this project

  • @ArnavBoom
    @ArnavBoom Před 4 lety

    At this point somany ideas are floating on my mind for games that I even could code.....I already now coding but you teached me some more tipps like AddForce or else. I just want to say THANK YOU FOR THE MOTEVATION

  • @aeroder5591
    @aeroder5591 Před 6 lety +5

    It displaeys an error when i declare the public playermovement movement;
    Says that
    Unexpected symbol public

  • @Sucky409
    @Sucky409 Před 2 lety +8

    i have a question. When we put Debug.Log statement whenever two things collide and we add an obstacle, shouldnt the obstacle also collide with the ground and add a statement in the console?

    • @freedomtheplayer4235
      @freedomtheplayer4235 Před 2 lety +2

      since the script was attatched to the "player" cube, it only produced a message when the player cube collided with something. if you were to attatch the script to the obstacle too, it would have produced the message, too.

  • @turtleguy944
    @turtleguy944 Před rokem

    Best unity tutorials I will be using thank you for making this

  • @ppandolff9038
    @ppandolff9038 Před 4 lety +2

    Im very late and you probably won’t see this but damn, this series is so great and helpful!

  • @PippyPopsSelfHarmMonica
    @PippyPopsSelfHarmMonica Před 2 lety +4

    it keeps saying i hit an object as soon as it starts despite the ground being named Ground and the Obstacle being named Obstacle.

    • @PippyPopsSelfHarmMonica
      @PippyPopsSelfHarmMonica Před 2 lety +2

      Nvm... left a ; after the if statement which screwed me up but fixed it... leaving this up just in case anybody did the same

    • @raafayhemani2018
      @raafayhemani2018 Před 2 lety

      @@PippyPopsSelfHarmMonica Such great help thank you so much

  • @Charlie13O2
    @Charlie13O2 Před 2 lety +3

    If you’re having issues at 4:20 rename the script to something other than “Collision” , it confuses unity and causes errors. Also change the 5th line to “void OnCollisionEnter (UnityEngine.Collision collisionInfo)”

    • @matto1919
      @matto1919 Před 2 lety

      now it just outputs untagged in console

  • @jodeer3232
    @jodeer3232 Před 3 lety +1

    1. I really love the series thank you so much
    2. Not important but if you are watching through them now its so unsatasfine if the backround and your position is the same but your T-Shirt changes

  • @bloon_dude7332
    @bloon_dude7332 Před 2 lety +2

    You're doing a really good job, keep it up.

  • @KingNBearFutbolenVivo
    @KingNBearFutbolenVivo Před 6 lety +10

    For those are having troubles about the collisions code, just change this.
    void OnCollisionEnter (UnityEngine.Collision CollisionInfo)
    instead of
    void OnCollisionEnter (Collision CollisionInfo)
    AND
    if (CollisionInfo.gameObject.name == "Obstacle")
    instead of
    if (CollisionInfo.collider.name == "Obstacle")
    NOTE: Dont use Collision.gameObject.tag, because our objects are untagged.

    • @ivsatyouu5285
      @ivsatyouu5285 Před 5 lety

      If you have trouble with this, its because he changed the Collision name to a capital C. make sure all of the variable names are EXACTLY the same (yes its case sensitive)

    • @sjanderson2949
      @sjanderson2949 Před 5 lety

      THANK YOU!!!!!!!

    • @Mad_Elephant.
      @Mad_Elephant. Před 2 lety

      tysm

  • @imconfused6955
    @imconfused6955 Před 7 lety +17

    These are great, but I still haven't revived an answer to a question. I have been asking for a long time. Can you make it so the map random generates and the game is endless

    • @RitobanRoyChowdhury
      @RitobanRoyChowdhury Před 7 lety +12

      You can. Look up Procedural Generation. Sebastian Lague has a series on it, and there are plenty of Unite talks on the subject (e.g. procedural generation in Sir, You are Being Hunted). The Procedural Generation Wiki and the website donjon (donjon.bin.sh/) have some good material that you should look at.

    • @matttilly1302
      @matttilly1302 Před 6 lety +1

      I was thinking about trying to implement this as well. My idea was to have the ground keep extending on the z axis a the same rate at the player moves forward until player == collision

    • @Fwizzle45
      @Fwizzle45 Před 6 lety

      As the other guy said, you guys are talking about procedural generation. It's the idea of randomly creating maps based on preset stuff. So it can take 10 different obstacles you created and will randomly generate them in different configurations. Could be set to do this indefinitely.

  • @roundpigeon492
    @roundpigeon492 Před 3 lety +1

    nice series
    I can finally understand programing

  • @chrisgaming9567
    @chrisgaming9567 Před 2 lety +2

    This went perfectly well

  • @tinymooshmallow6181
    @tinymooshmallow6181 Před rokem +3

    Assets\PlayerCollision.cs(6,12): error CS0246: The type or namespace name 'PlayerMovement' could not be found (are you missing a using directive or an assembly reference?)

  • @Milenialtherapy
    @Milenialtherapy Před 4 lety +41

    For me it worked when i used following:
    void OnCollisionEnter(UnityEngine.Collision collisionInfo)
    {
    if (collisionInfo.gameObject.CompareTag("Obstacle"))
    {
    Debug.Log("we hit annother sphere");
    }

  • @fogardogaming1873
    @fogardogaming1873 Před 2 lety

    so far I am able to follow the series.
    although last time I made some errors which were hard to resolve.

  • @user-jn9nu4ef3v
    @user-jn9nu4ef3v Před 4 lety

    Brackeys you are the nicest and best CZcamsr you helped me alot :D

  • @AngelTFC
    @AngelTFC Před 4 lety +5

    "We can use the dot to assess in to different infos, stuff like the Impact Foursome.." - Brackeys ;)

    • @varunbajoria6126
      @varunbajoria6126 Před 3 lety

      im having a problem with this as the dot doesnt show any info in visual studio code

    • @ilovecairns5181
      @ilovecairns5181 Před 3 lety

      They didn’t say that ok, this is a joke

    • @varunbajoria6126
      @varunbajoria6126 Před 3 lety

      @@lewel3788 it was 3months ago and no i had exams

  • @resharper9750
    @resharper9750 Před 3 lety +24

    For anybody stuck at 7:00 who's PlayerMovement isn't working, just remove all caps and type in playermovement (all small) instead. It'll work just fine..
    Thank me Later
    MY CODE though:
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class playercollission : MonoBehaviour
    {
    public playermovement movement;
    void OnCollisionEnter (UnityEngine.Collision collisionInfo) {
    if(collisionInfo.collider.tag == "Obstacles"){
    }
    }
    }

  • @thomb.9013
    @thomb.9013 Před 3 lety

    i just went back to this because i needed to know how to check for collisions, this can be usefull for jump mehcanics, so i did!
    now i can see if im grounded without a groundcheck

  • @unstable6155
    @unstable6155 Před 3 lety

    this youtube series helped me get into coding

  • @thomasremstedt5499
    @thomasremstedt5499 Před 5 lety +9

    Still, love how he says "Wednesday"! XD

  • @syth-1
    @syth-1 Před 4 lety

    these videos are amazing and really informative, thank you,

  • @thebaldguy458
    @thebaldguy458 Před 3 lety

    thankyou these series help me very much

  • @yourlocalmemejoint8325
    @yourlocalmemejoint8325 Před 6 lety +14

    you deserve more subs

  • @tal1753
    @tal1753 Před 4 lety +23

    Hello, I receive this error: Assets/PlayerCollision.cs(5,9): error CS0246: The type or namespace name 'PlayerMovement' could not be found (are you missing a using directive or an assembly reference?) . Can someone help me?
    Edit: The reason you have this problem is that you must have misspelled PlayerMovement in one of the scripts.

  • @hammadshahzad8994
    @hammadshahzad8994 Před 3 lety

    Realllllly love his videossssssss

  • @lvlupworldnews8202
    @lvlupworldnews8202 Před 3 lety

    Third time watching in two days. Get in my head knowledge !!!!!

  • @theplayer20
    @theplayer20 Před 7 lety +5

    if you're back
    could you make a video of how to make a game like piano tiles

  • @MrOmniscience
    @MrOmniscience Před 5 lety +46

    For anyone that's new: This is the code that works now:
    ___________________________________
    using UnityEngine;
    public class Collision : MonoBehaviour{
    public PlayerMovement movement;
    void OnCollisionEnter(UnityEngine.Collision collisionInfo)
    {
    if (collisionInfo.collider.tag == "Obstacles")
    {
    movement.enabled = false;
    }
    }
    }
    ___________________________________
    Thanks to NichoBeastMode!

  • @KhalidBhat-fs9uc
    @KhalidBhat-fs9uc Před rokem

    I know you have just stop uploading videos but still you have helped me a lot and that is why i am commenting.

  • @Immdumb
    @Immdumb Před 14 dny +1

    I have it as saying "We started the fire" and hummed We didn't start the fire, at the start of the video

  • @lil_sweden2323
    @lil_sweden2323 Před 4 lety +10

    3:59 how to set that in VS ?
    The thing that shows you what that code do. Please help

    • @user-te9vx8bx8y
      @user-te9vx8bx8y Před 4 lety +2

      Yep, wondering as well.. :/

    • @cloveri1310
      @cloveri1310 Před 4 lety

      Did you guys figured it out?

    • @cloveri1310
      @cloveri1310 Před 4 lety

      @@user-te9vx8bx8y Did you figured it out?

    • @user-te9vx8bx8y
      @user-te9vx8bx8y Před 4 lety

      @@cloveri1310 IIRC, I installed an older version of visual studio and had to completely wipe my version and install a new one. Make sure to delete any files that has to do with VS. Also, check the place you download.