How to make a Video Game in Unity - CAMERA FOLLOW (E04)

Поділитися
Вставка
  • Опубліковано 14 лют 2017
  • Let's make our camera follow our player!
    ● Download scripts, assets and project files for this course: 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...

КОМЕНТАРІ • 2,5 тис.

  • @Brackeys
    @Brackeys  7 років тому +1095

    Hey guys! I'm glad you guys are liking the series so far :)
    I try to put as much effort into each single episode as possible! I also see a lot of you commenting that you would like to see more videos each week. While I would love that too it just isn't possible for me at the current time. Making these videos takes A LOT of time and while I try to put all my focus into the UA-cam channel I do have to dedicate myself to client work here and there in order to pay the bills. If you would like to see more videos I would suggest becoming a Patreon Supporter. This allows me to put more time into the channel without having to worry about the financial aspect. You can do so here: patreon.com/brackeys
    Thanks for being so awesome and supportive! Can't wait to bring you guys more content :D

    • @bigjay9184
      @bigjay9184 7 років тому +2

      Gr8 series...keep going buddy

    • @skorpion4368
      @skorpion4368 7 років тому +4

      Brackeys, Is there anyway to donate you by SMS ? You are doing great work, and I actually feel like, I can make games. BTW. sorry for bad grammar XD

    • @skorpion4368
      @skorpion4368 7 років тому

      Lol 666$ per week :_:

    • @varshitratna9688
      @varshitratna9688 7 років тому

      Brackeys i have published an app in play store after learning from your videos. Beat My Score. an endless game when troll faces irritate us while playing. it will be soon on appstore. please make a review video or a short video showing my app in ur videos

    • @GameDevelopmentChannel
      @GameDevelopmentChannel 7 років тому

      Thanks

  • @mingangxu2125
    @mingangxu2125 4 роки тому +1584

    Anyone else get that feeling of satisfaction when the code works

    • @autonaut279
      @autonaut279 4 роки тому +23

      Totally

    • @counterscam6547
      @counterscam6547 4 роки тому +180

      anyone feel the frustration after spending hours debuging and finding out a letter was lowercase

    • @pinkiepurplez
      @pinkiepurplez 4 роки тому +18

      Same, its like you are a pro gamer.

    • @SenatorRocket
      @SenatorRocket 4 роки тому +42

      ​@@counterscam6547 that is the worst feeling in the world.

    • @sutirthjha4539
      @sutirthjha4539 3 роки тому +6

      Yeah

  • @ninjaaa_lol5306
    @ninjaaa_lol5306 7 років тому +1911

    I would rather have 100 simple and short tutorials like this than any other way

    • @geluidsbox9195
      @geluidsbox9195 6 років тому +44

      Found this one after following a tutorial that took me over 8 hours, tutorials like this with 10 minutes per part are great!

    • @stefantanasa13
      @stefantanasa13 6 років тому +31

      You are absolutely right. It is best to learn in small steps and always with a practical example in front of you so that the information is 100% understood. Great tutorials!

    • @MaxCE
      @MaxCE 5 років тому +5

      ikr

    • @thatoneweirdkidd
      @thatoneweirdkidd 5 років тому +4

      Ikr

    • @DeTalented
      @DeTalented 4 роки тому +2

      666 likes... NICE

  • @TheKaswestcomix
    @TheKaswestcomix 4 роки тому +1346

    I'm seriously having the best time doing this.
    Every step is working as I go, and I'm building confidence as I go.
    Thank you so much.

    • @duckking5702
      @duckking5702 4 роки тому +9

      Ikr.

    • @goblinman3010
      @goblinman3010 4 роки тому +22

      Hell yeah let's keep at it

    • @lachiebell9656
      @lachiebell9656 4 роки тому +3

      same

    • @martinvdev1565
      @martinvdev1565 4 роки тому +21

      I am smiling every time I do any kind of little thing is just so...
      Just feels good

    • @averywow
      @averywow 4 роки тому +7

      sameee any time i've ever tried doing *anything* creative it ended up horribly but i feel like a pro when i do this lol

  • @morningawesome
    @morningawesome Рік тому +51

    6 years and this is still so freaking helpful. I'm grateful your channel exists

  • @calebc339
    @calebc339 4 роки тому +414

    i watched this 3 times while my unity loaded

    • @June_The_Goon
      @June_The_Goon 4 роки тому +17

      @Asphyxation UNITE

    • @gamingmetjayden1361
      @gamingmetjayden1361 4 роки тому +6

      SHITPC! i have an laptop that just works

    • @mello2472
      @mello2472 4 роки тому +4

      @@gamingmetjayden1361 grammar much

    • @larry9195
      @larry9195 3 роки тому +1

      jesus

    • @nenyashamajoboro3770
      @nenyashamajoboro3770 3 роки тому +4

      I watched 4 episodes while I was downloading unity not including the intro to the series

  • @patrik8642
    @patrik8642 2 роки тому +49

    the camera code is
    using UnityEngine;
    public class FollowPlayer : MonoBehaviour
    {
    public Transform player;
    public Vector3 offset;
    // Update is called once per frame
    void Update()
    {
    transform.position = player.position + offset;
    }
    }
    for anyone who can't see the video at the moment
    edit: ah yes i figured it out, after dragging the script to the camera and selecting the camera, there should be a slot where you can drag the cube on, and like Jonathan said change the offset a little and you should be good to go.

    • @jonathanlindqvist570
      @jonathanlindqvist570 2 роки тому +3

      Thanks. And also don't forget to adjust the "offset" values in Unity so that you can actually see the cube :) Otherwise you'll be inside of it. Just click the camera and put like x=0, y=2, z=10 or whatever you think works well.

    • @cancerina4474
      @cancerina4474 2 роки тому

      @@jonathanlindqvist570 hey bro can you see the video?

    • @jonathanlindqvist570
      @jonathanlindqvist570 2 роки тому

      @@cancerina4474 No I can't see it either unfortunately. But I fixed the camera that way, perhaps there are better ways :)
      Edit: just use the code provided above by Patrik Puskas, add a script to the camera and put the code there. Then go in to Unity and adjust the offset values when you have selected the camera. Hope it works!

    • @cancerina4474
      @cancerina4474 2 роки тому

      @@jonathanlindqvist570 do you got a discord so i can ask you something because i got stuck?

    • @jonathanlindqvist570
      @jonathanlindqvist570 2 роки тому

      @@cancerina4474 sure, give me your discord tag and I'll add you

  • @megatoast5984
    @megatoast5984 2 роки тому +16

    4 years later, even after retirement, his tutorials are helping so many such as me. thanks, dude

    • @HazardIg
      @HazardIg 2 роки тому

      I'm upset because the video isn't working anymore.. it hasn't been deleted, it just doesn't work. I've refreshed the app, restarted my device, switched devices, nothing works...

    • @lunathecat4318
      @lunathecat4318 2 роки тому

      @@HazardIg same, it doesn't work for me

    • @HazardIg
      @HazardIg 2 роки тому

      @@lunathecat4318 okay so it's definitely a youtube problem then.. well I guess we'll have to learn by ourselves lol

    • @swordeyeman2884
      @swordeyeman2884 9 місяців тому

      ​@@HazardIgmine is working

  • @zerorilation
    @zerorilation 4 роки тому +752

    During Quarantine : I'm bored..
    Also During quarantine: Learning unity via tutorials
    Who else is here during the pandemic?

    • @ente-cover2246
      @ente-cover2246 4 роки тому +7

      Haha me too, have fun coding ;)

    • @codeylee8494
      @codeylee8494 4 роки тому +3

      i already knew python thanks to my CS class but i prefer making games which isn't as easy with python so these videos have really helped, i'm also doing this @ 02:15 so i'm not getting up in the morning lol.

    • @KraisonFrameworks
      @KraisonFrameworks 4 роки тому +2

      Me. I got inspired to make a game, so here we are.

    • @paulowg7940
      @paulowg7940 4 роки тому +1

      me too

    • @sanderbos7941
      @sanderbos7941 4 роки тому

      yup..

  • @mr.mysteriousyt6118
    @mr.mysteriousyt6118 7 років тому +445

    simple and clear I love what you're doing

  • @rajdhakate617
    @rajdhakate617 4 роки тому +41

    It's been 4 days I've discovered this channel and I'n already in love with game development. You make your videos very interesting and educational. Very well done.

    • @stealth2338
      @stealth2338 2 роки тому

      and its been 5years for me and this video is really helpful.

  • @larry9195
    @larry9195 3 роки тому +6

    the thing I love about these tutorials is that they are free. I was watching some other UA-camrs on how to do this (no offense to them but they couldn't teach crap), then I come here, watch the first tutorial and... to say the least... I'm instantly hooked. these are *FREE*. I've never taken a paid online course but its gotta be on par with this AT LEAST if I'm ever gonna buy them.
    *This guy has the right idea about teaching beginners.*

  • @ashleywolf5522
    @ashleywolf5522 5 років тому +225

    UDEMY is like a psycho ex who just keeps coming back even though I’ve already reattached with Brackeys.

    • @NoOffenseAnimation
      @NoOffenseAnimation 5 років тому +9

      I remember getting jealous I couldn't have Udemy but turns out, like, YT tutorials are mostly better...

    • @nothingtoseehere6142
      @nothingtoseehere6142 5 років тому +1

      @@NoOffenseAnimation The classes are like ten bucks a piece.

    • @shashwatpandey8766
      @shashwatpandey8766 3 роки тому

      Ashley, that's awfully specific, you okay?

    • @fatmasayah109
      @fatmasayah109 2 роки тому

      @@nothingtoseehere6142 10 bucks a breath u take in them lol

  • @krishbeats6957
    @krishbeats6957 4 роки тому +8

    the most legendary and beginner-friendly game- dev tutorials I have ever seen on youtube
    thank you, bro
    i hope u succeed in ur youtube and game development life

  • @zooMbasta
    @zooMbasta 4 роки тому +2

    it's so unbelievably exciting to wonder about the different things you can actually do with these tools, and knowing so little about it makes it even better,
    letting your mind race and wonder what could be made.

  • @d-bro-sector36
    @d-bro-sector36 3 роки тому

    Even though it goes fast, it is logical enough to follow, and your face and voice are super friendly which makes it a very pleasant learning experience.

  • @miffedcrew8868
    @miffedcrew8868 6 років тому +45

    6:24 What we all think of UA-cam!

  • @bojken5384
    @bojken5384 7 років тому +81

    Thanks Brackeys again.Keep doing what you're doing.You are the man bro.

  • @ScoutOW
    @ScoutOW 4 роки тому +2

    I just wanted to say you seem like a really great person and clearly, it shows, you always have a smile on your face like you are so excited to teach us and honestly it makes me so motivated to keep learning, so from the bottom of my heart, thank you so much for these videos!

  • @aliciabogdan1110
    @aliciabogdan1110 5 років тому

    About 2 months ago I decided I want to make at least one video game this summer. You motivated me to start right now, and I'm super happy that I can learn really easy with your tutorials. I just wanted to say THANK YOU for putting so much effort in these tutorials and helping others out, I really really appreciate it

  • @BaconPvP101
    @BaconPvP101 7 років тому +126

    Amazing, you explain everything so well. Thanks, can't wait for the next episode!

    • @Brackeys
      @Brackeys  7 років тому +21

      Thanks a lot, glad you like it! :D

    • @bluestareverything9716
      @bluestareverything9716 4 роки тому +2

      Oh no it’s 70!

    • @fatmasayah109
      @fatmasayah109 2 роки тому +2

      @@bluestareverything9716 im from the future its 115

    • @efelk1039
      @efelk1039 2 роки тому +1

      @@fatmasayah109 im from 19 hours in the future it is 116

    • @ansh4621
      @ansh4621 2 роки тому +1

      @@efelk1039 its 119

  • @autumn_exe8785
    @autumn_exe8785 4 роки тому +4

    Thank you so much for these easy to understand tutorials. You’ve somehow made me excited to learn more code. You’re tutorials are the best!

  • @chadxox3
    @chadxox3 3 роки тому

    If anyone has the issue in the console where it says something about SystemDebug or UnityEngine.Debug, then change...
    "Debug.Log(player.position);"
    To
    "UnityEngineDebug.Log(player.position);"
    PS: You just earned a sub because of this. So many people have made this a lot more complicated then it should be when it comes to using Unity or coding, you are not one of those people. Thanks Brackeys.

  • @whyzen2081
    @whyzen2081 4 роки тому +1

    I've been trying to learn the basics as a complete beginner, and I've started and stopped on different tutorials and courses probably 5 times in the last few months, as I usually find the instructions to be difficult to digest with no relatable experience. But watching your series is a breath of fresh air. I finally feel like I'm getting somewhere. I just wish I started learning when I was younger, as my 30 year old brain is like a sieve at this point.

  • @serg10x
    @serg10x 5 років тому +3

    These tutorials are amazing, I took programming sometime ago so this is a nice refresher!

  • @gcasello494
    @gcasello494 4 роки тому +74

    Just in case someone like me gets lost:
    If you added the script and all, make sure you added the component to the Main Camera and not to the Player. Dumb me did that, and I spent 10 minutes trying to figure that out.

  • @MijmerMopper
    @MijmerMopper 10 місяців тому

    I love how you are actually teaching the basics people like me want to know. I can now apply the same basic information to play around and make the light a spotlight that follows the player.

  • @ShaneeeXD
    @ShaneeeXD Рік тому

    I love how he seems always excited to teach and share somethings with us right from the start of the video. Thank you so much!!!

  • @KineticPixell
    @KineticPixell 7 років тому +10

    You have amazing tutorials!! I am currently busy on a game and your basic tutorials like this really help me with it!
    I am making a game at school and the teacher is really looking forward to my finished product :D

    • @Stormy566
      @Stormy566 7 років тому +1

      Post a link to some pictures of it when you are done :D and don't forget to reference Brackeys if you copied any code directly :)

    • @KineticPixell
      @KineticPixell 7 років тому +1

      Shane McNeill Alright!!
      I will do that :D

    • @TheMegaLeotv
      @TheMegaLeotv 5 років тому +1

      @@KineticPixell So what happened to a game?

  • @user-vz7um7om6k
    @user-vz7um7om6k 4 роки тому +52

    lol u still give hearts even after 2 years... thats so cool.... btw ur tutorial is way more easier to understand then others i watch :)

  • @lukeblaker5625
    @lukeblaker5625 4 роки тому

    I was worried I'd have to end up coding something to make the camera follow the player, but I'm happy it was so simple. I'm so glad your channel exists, thanks!

  • @tomgreenan9521
    @tomgreenan9521 5 років тому +1

    This is the best tutorial series I have ever watched on anything! Really well done

  • @xDeLoreanMusicx
    @xDeLoreanMusicx 7 років тому +3

    Continue your videos man, its very helpfull and you're a great teacher ! Nice work Brackeys :D

  • @sebastiandeerhead4564
    @sebastiandeerhead4564 7 років тому +10

    So cool! Thanks, Brackeys!

  • @pajaspk
    @pajaspk 4 роки тому

    This guy has real ability to learn others ! The way he explains programming is so cool . I have met lots of teachers, who were not able to transfer the knowledge this effectively :) good work

  • @kiwigabroos9743
    @kiwigabroos9743 3 роки тому

    GOT A UNI PROJECT, AND THIS IS THE BEST WAY TO LEARN UNITY YOU ARE A LEGEND BRO 1000X TIMES BETTER THAN MY LECTURERS

  • @seunn
    @seunn 7 років тому +23

    This series is seriously a BIG help, I am a 10 year old game designer, (I have been interested in making games more than playing them) and your tutorials are the best I could find on the internet. Would recommend to anyone starting in unity!

    • @Elektro8888
      @Elektro8888 7 років тому +8

      I envy you lol.Wish i had access to this when i was 10 :D

    • @Beyblade0battles
      @Beyblade0battles 6 років тому +7

      I'm very happy to see you two young people trying to develop games! You are the future! Good luck my friends!

    • @user-pq4mt7em3i
      @user-pq4mt7em3i 6 років тому +3

      Lol I am 12 and developing tooo xD

    • @brainiax2602
      @brainiax2602 6 років тому +9

      xblooified no way you’re ten, you have better grammar than like half of the internet.

    • @loogmm
      @loogmm 6 років тому +1

      13 XD

  • @willpetillo1189
    @willpetillo1189 3 роки тому +64

    For those using this as a reference or wanting to review specific parts
    of the lesson, here are some time-stamps of interest:
    0:11: Setting the camera's parent.
    0:49: Writing a script to control camera movement
    1:25: Accessing the Transform of a different object
    2:55: Setting an object's position to match another object's position
    4:07: Adding an offset to the camera follow for a 3rd person view

  • @sixdsix5028
    @sixdsix5028 4 роки тому

    These are really solid tutorials, mate! I am almost 30 years old and trying to get into game dev again. I screwed around with GameMaker in my teens for a few months and haven't really done anything else since. Cheers!

  • @ypaut
    @ypaut 5 років тому +1

    Even as a CS student, with my head hit all day with OO programming, your vids are nothing like boring. Best chanel.

  • @BradyHege
    @BradyHege 4 роки тому +5

    For anyone that got a compiler error saying that transform (in the line transform.potition = player.position) this is what worked for me:
    Create a new public transform (I called it "me") and set that transform object to the camera. Then just change (transform.position = player.position) to (me.position = player.position)

  • @deadoralive5690
    @deadoralive5690 4 роки тому +3

    I donated to patreon, liked and subscribed! Keep up the hard work!

  • @coltonsparks9079
    @coltonsparks9079 4 роки тому

    I don't comment much, but I love this guy's videos. I've tried so many things to learn gaming making. I've done Udemy, Corsera, and a few others. All of them seem to throw you into the wolves den when you start and they give you too much info in a short amount of time, its refreshing to see someone who is taking us steps at a time. One thing I'm glad about is that I just found this channel a while ago, so i have a massive backlog to watch and learn. Thank you so much Brackeys.

  • @one.framer
    @one.framer 4 роки тому +1

    Thank you for this series, its so easy to learn from you, I made the game in about 7 hours and remembered everything, Thank you so much!!!!!

  • @camikitty276
    @camikitty276 4 роки тому +14

    i think this is the only time i've pressed the bell when the youtuber says too

  • @LiterallyWize
    @LiterallyWize 3 роки тому +16

    "Unless you have experience with college level math,"
    Me, a person that used to have experience with math and now doesn't; *_casually starts shaking_*

  • @sajadtorkamani9399
    @sajadtorkamani9399 4 роки тому +1

    Wow, these are some of the best tutorials I've ever seen on any topic!

  • @Diegovnia
    @Diegovnia 4 роки тому +1

    These are great! I was learning Python for a while now as I was really scared of C# and here I am actually seeing that C# isn't that hard, plus the satisfaction that the code have real life output. Thanks!

  • @inlearn1009
    @inlearn1009 3 роки тому +6

    6:24 *the first time Brackeys shows emotions.*

  • @GavinHaubeltMedia
    @GavinHaubeltMedia 7 років тому +5

    Awesome as always!

  • @perlinfall
    @perlinfall 4 роки тому

    Your tutorials are some of the best I've ever seen. Worth more then PAYED tutorials.

  • @Chevifier
    @Chevifier 5 років тому

    Clear, concise to the point. What more could I ask for. Loving these.

  • @osmanmohammad9118
    @osmanmohammad9118 5 років тому +7

    tHIS GUY DESERVES THE BEST THIS GUY DERSERVES WAY MORE SUBS.

  • @TimM-kz1vl
    @TimM-kz1vl 4 роки тому +11

    My notes on this vid so you don't have to rewatch it: Video 4: Camera Follow
    Drag and drop camera onto player object. This creates a problem where the camera spins with the player and we must add a script to fix it. We then unparent the camera from the player (Drag camera object back to the list.) and create a script that makes the camera follow the location of the player.
    public Transform player; //adds a variable named “player” that tracks their Transform (Location)
    This will create a slot in the inspector for the camera. Just drag the player object to that slot.
    Then add transform.position = player.position // transform with a lowercase t refers to the location of our current object, aka the object this script is sitting on (the camera) then tells the camera’s position to update to the player’s position.
    At this time, the camera is now inside the player object and we want to move it back.
    We’re going to go back into the FollowPlayer script and add public Vector3 offset;
    Vector3 is just keeping track of the x y and z variables. Set the variables to w/e you want the camera offset to be like Y 1 and Z -5 to move the camera up and back.
    Then go back into the code and change
    transform.position = Player.position;
    to
    transform.position = Player.position + offset; //this means your camera’s position is the same as the player’s but combined with the offset.

    • @greyseth2721
      @greyseth2721 4 роки тому

      it says that Transform does not contain a definition for potition :\

    • @TimM-kz1vl
      @TimM-kz1vl 4 роки тому

      @@greyseth2721 try lowercase transform

    • @1nsstinct227
      @1nsstinct227 3 роки тому

      thank you it helped a lot

  • @teamFlemiX94
    @teamFlemiX94 5 років тому +1

    I'm loving this series, the tutorial are so clear and quick, thanks a lot.

  • @fuzzybrickstudios2315
    @fuzzybrickstudios2315 4 роки тому

    it feels so much easier once you finish all of the trouble shooting and even that is fun! thanks so much for making these tutorials!

  • @AdiHasArrived
    @AdiHasArrived 6 років тому +5

    I'd reccommend anyone starting with game development to watch Brackey's tutorials.

  • @ataba8481
    @ataba8481 5 років тому +190

    I did every single thing in the video in the same way that you did. BUT, it did not work the camera is still rotating with the player...help
    **(edit) nevermind I found the problem... I forgot to unparent the camera.**

    • @nachoe1266
      @nachoe1266 5 років тому +9

      jaaj i was looking for 30 min and saw your edited comment
      thnx

    • @mythicknight8269
      @mythicknight8269 5 років тому +4

      @@sbruins35 Drag it away from whatever you parented it to and place it I anywhere in the hierarchy (were all your other things are)

    • @mythicknight8269
      @mythicknight8269 5 років тому +5

      Edits isn't working so I'm gonna put this here 0:48 is were he Un-parents the camera

    • @bgsquiff5116
      @bgsquiff5116 4 роки тому +1

      Thanks!

    • @DashMatin
      @DashMatin 4 роки тому +1

      directed by :

  • @vaaronka
    @vaaronka 4 роки тому

    You are the first youtuber what i saw who cuts the crap, has a good tempo and says only the important information. Keep up!

  • @woslogoslo4932
    @woslogoslo4932 3 роки тому +2

    I am starting programming while still in highschool so that i have experience when looking for a job. This series is really helping me thanks so much!

    • @srimannsatpathy761
      @srimannsatpathy761 3 роки тому

      I am still in middle school and i am starting to learn programming in c# and python not to brag but yeah

  • @queengold3801
    @queengold3801 2 роки тому +3

    I am still in High School, and this really helped me, so i think when we start to do things like this, I will be able to be really good at it. Thanks :)

    • @HazardIg
      @HazardIg 2 роки тому

      Bro cam you maybe help me out? The video won't load as if it's been deleted.. I really wanna be able to know how to make the camera work but I can't without this video

    • @GioTeo
      @GioTeo 2 роки тому

      @@HazardIg same happens to me, did you find a fix?

    • @GioTeo
      @GioTeo 2 роки тому

      Actually, someone else in the comments posted a different video which is for the camera as well: ua-cam.com/video/MFQhpwc6cKE/v-deo.html

    • @HazardIg
      @HazardIg 2 роки тому

      @@GioTeo Not yet no, still trying things out

    • @HazardIg
      @HazardIg 2 роки тому

      @@GioTeo found a work around

  • @gs4207
    @gs4207 5 років тому +12

    how to make the camera moves with the player .
    hold the camera and drop it on the player . DONE !
    30 second tutorial .
    THIS IS WHY I LOVE THIS CHANNEL . . . because of its SIMPLICITY
    P.S . I watched the whole video

  • @antonyynotna202
    @antonyynotna202 4 роки тому +1

    I don't usually Like and click on notifications, but when I do, it means this person is awesome! Im new to coding so this is just amazing.

  • @lukalevak1434
    @lukalevak1434 4 роки тому +1

    Seriously, good job! This makes learning unity so much easier!

  • @owez7113
    @owez7113 5 років тому +13

    To make an automatic offset:
    top of class:
    *private Vector3 offset*
    start method:
    *offset = transform.position - player.position;*
    update method:
    *transform.position = player.position + offset;*

    • @TheHollowayPower
      @TheHollowayPower 4 роки тому +2

      Owez wait what lol

    • @TheHollowayPower
      @TheHollowayPower 4 роки тому

      @Achintya Dass shut up

    • @kasiaczek0000
      @kasiaczek0000 4 роки тому

      thanks! helped

    • @kasiaczek0000
      @kasiaczek0000 4 роки тому +2

      ps. that is my code
      using UnityEngine;
      public class camerafollow : MonoBehaviour
      {
      public Transform player;
      public Vector3 offset;
      void Start ()
      {
      offset = transform.position - player.position;
      }
      void Update ()
      {
      transform.position = player.position + offset;
      }
      }

    • @bedirhansiniko6757
      @bedirhansiniko6757 4 роки тому

      @@kasiaczek0000 Thanks. I was having an error and your code worked!

  • @cianmeegan1215
    @cianmeegan1215 6 років тому +5

    Brackey i followed your player movement script but it keeps saying the parameter name player and offset are duplicates, ive even downloaded your project files and used that one but the problem keeps happening, can you help me?

  • @huebirdfan2.0
    @huebirdfan2.0 2 місяці тому

    Even though these videos are 7 years old, they still really helped me. Thanks :)

  • @jdgfshdjfkakahdkshfhdjdh
    @jdgfshdjfkakahdkshfhdjdh 3 роки тому

    I love these so much, trying a code and finding the problem when it doesn't work is so frustratingly satisfying

  • @chickenscripkids9465
    @chickenscripkids9465 3 роки тому +6

    every time he says, "to do that we need to add another variable" i feel like im dying inside

  • @hollowsoul5499
    @hollowsoul5499 4 роки тому +14

    worked for me in visual studio 2019 & unity 2020 like this
    using UnityEngine;
    public class followPlayer : MonoBehaviour
    {
    public Transform playerTransform;
    private Vector3 _cameraOffset;
    [Range(0.01f, 1.0f)]
    public float SmoothFactor = 1f;
    void Start()
    {
    _cameraOffset = transform.position - playerTransform.position;
    }
    void LateUpdate()
    {
    Vector3 newPos = playerTransform.position + _cameraOffset;
    transform.position = Vector3.Slerp(transform.position, newPos, SmoothFactor);
    }
    }

    • @moeezsaleem1091
      @moeezsaleem1091 4 роки тому +8

      man your are a life saviour thankyou so much i was trying to solve this for 2-3 hours

    • @fysys_56
      @fysys_56 4 роки тому +1

      Ur a life saver! Thank u so much!

    • @theimpx7965
      @theimpx7965 4 роки тому +1

      Thank you!!!

    • @nayanjyotidas7490
      @nayanjyotidas7490 4 роки тому

      Can you explain the extra stuff that you added?

    • @jaydenmassiah9515
      @jaydenmassiah9515 4 роки тому +1

      it still dosent work for me :(

  • @thenightowl2012
    @thenightowl2012 5 років тому +1

    This Series is so good im making my first right now and this is helping me understand how to use Unity! Thanks!

  • @denysbaiev167
    @denysbaiev167 2 роки тому +1

    You are a great team! I started from your C# tutorials and now I'm studying Unity by your videos. And this is very fun and inspiring! Thank you!

    • @Pezicodes
      @Pezicodes 2 роки тому +1

      Hi.
      I learnt all i know from brackeys...
      I'm a game developer too........
      I can help with any question
      please ask your questions i can help
      i also make game development videos
      please support my channel
      ua-cam.com/users/itsPeziTutorials

  • @kryptictoast229
    @kryptictoast229 4 роки тому +264

    yeah i call myself a coder
    c copy
    o off
    d brackeys
    e tutorials
    r :)

    • @loyalty9193
      @loyalty9193 4 роки тому +15

      @@avinath1 ruining shit for people lmfao

    • @beepboop6199
      @beepboop6199 4 роки тому +5

      @Sam The Scissor Ok guy named Sam The Scissor...

    • @ajayselladurai7018
      @ajayselladurai7018 4 роки тому +5

      KadabraX_X no body fucking asked

    • @beepboop6199
      @beepboop6199 4 роки тому +3

      @@ajayselladurai7018 Ok guy named Ajay Selladurai..

    • @ajayselladurai7018
      @ajayselladurai7018 4 роки тому +4

      KadabraX_X fuck off wanka

  • @scripticstudios2022
    @scripticstudios2022 3 роки тому +6

    This doesn't work for me... I followed along with the tutorial and even downloaded the source code and nothing changes; it doesn't even give a first-person view. I really enjoyed your tutorial and hope I can get some help.
    EDIT: I used Brackeys Smooth Camera Tutorial and I got it to work.

  • @vincentsavoretti2201
    @vincentsavoretti2201 3 роки тому

    You're a gift, pure and simple

  • @dhunHERO
    @dhunHERO 3 роки тому

    THIS IS MY JAM, C# AND UNITY TUTORIAL ALL IN ONE IN A WAY I ACTUALLY UNDERSTAND, THANK YOU KIND SOUL

  • @christianjones3516
    @christianjones3516 2 роки тому +4

    This video isn’t working for some reason, but he has another video of the camera follow
    Just search “smooth camera following in unity” and it should show up

  • @scottfrost6181
    @scottfrost6181 2 роки тому +3

    Video 4 is not working. comes up with a video error message

    • @fodogamer6654
      @fodogamer6654 2 роки тому

      i reupload this on my channel
      ua-cam.com/video/-r7o4UcSKSE/v-deo.html
      you can check it out and continue!

  • @voxelbugged
    @voxelbugged 5 років тому +1

    Thank you for these tutorials, I wanted to get into using Unity once but it was very confusing, but now I understand things.

  • @adorablehoe
    @adorablehoe 3 роки тому +2

    Dude, your tutorials are freaking awesome! For once a tutorial video that's very info-dense and it's easy to follow!

  • @KF67382
    @KF67382 2 роки тому +3

    @Brackeys why does it say something went wrong tap to retry anyone else have this issue

  • @natemixon6346
    @natemixon6346 4 роки тому +3

    Im having trouble getting the camera angle to shownlike his does in the game view. Any suggestions?
    Edit: So I fixed it I went to main camera and open/added another camera and that fixed it

  • @Fran3Designs
    @Fran3Designs 4 роки тому

    You are simply the best Unity youtuber in the whole world, that's a really hard achieve, congratulations dude!

  • @cerulity32k
    @cerulity32k 3 роки тому

    Every time I write code, it works, and I understand and learn stuff, I get exponential satisfaction. Now I can move a player with controls and have the camera follow!

  • @HemantR.20930
    @HemantR.20930 2 роки тому +7

    If ur watching in 2022, does anyone have problem watching the vid it keeps saying An error occurred. Please try again later for me..

    • @fodogamer6654
      @fodogamer6654 2 роки тому

      i reupload this on my channel
      ua-cam.com/video/-r7o4UcSKSE/v-deo.html
      you can check it out and continue!

  • @knezivan1
    @knezivan1 6 років тому +25

    offset = transform.position - player.transform.position;
    that way it stays the way you made it in the scene editor

    • @swayam2316
      @swayam2316 5 років тому +2

      Thx bro my player would go flying like crazy if you didnt give me that code

    • @bedtimepodcast8798
      @bedtimepodcast8798 4 роки тому +1

      thank god your here. i wouldnt of been able to do the code without you lol!!! thx :D

  • @riccardo3647
    @riccardo3647 4 роки тому +1

    No comment… seriously, I have been watching your tutorials and I AM FINALLY UNDERSTANDING something! Thank you so much bro :D

  • @codeoftheprogrammer7171
    @codeoftheprogrammer7171 4 роки тому

    I'm loving this series.

  • @samuelshim4263
    @samuelshim4263 4 роки тому +6

    Hi dude, amazing video. I'm following it as I'm writing this. One question I had is that my Visual Studio doesn't seem to have the autocomplete that you have. Specifically for the components used by UnityEngine. I'm not sure how to get it. I looked online and they said restarting both VS and Unity should help, but this did not solve it. Is there something else I need to get? Like a plugin or something? Thanks

    • @linaloulou834
      @linaloulou834 4 роки тому +1

      You have to download Unity tools via Visual Studio installer. Go to Modify/Individual Components in Visual Studio installer, find Unity tools, tick the box, and complete the download.

    • @boredificationable
      @boredificationable 3 роки тому

      I had the same problem. JustTestOnly Haha got it right. You have to install unity tools via Visuall Studio Installer. docs.microsoft.com/en-us/visualstudio/cross-platform/getting-started-with-visual-studio-tools-for-unity?view=vs-2019 is what helped out

    • @tushardey7179
      @tushardey7179 3 роки тому

      Go to Edit>Preferences>External Tools. Choose Visual Studio in the External Script Editor. It should be working fine now

  • @thatkiddanny
    @thatkiddanny 2 роки тому +5

    Anyone else not able to watch the video due to a playback error? I can watch every video except this one just fine

  • @TheJustBasti
    @TheJustBasti 3 роки тому +1

    You made my day! You're a good lad, Brackeys.

  • @geedogx8143
    @geedogx8143 5 років тому

    Loving this im away to learn game development at college and this so far is giving me a big headstart

  • @Jay-ys4gh
    @Jay-ys4gh 4 роки тому +17

    After i typed everything that you put in the code exactly how you typed it, (at 2:28) it still doesn't show the player box at the bottom of the follow player script. I tried dragging the script onto the main camera and it just says it needs to derive from a monobehaviour file and that mine is a Assembly.info.cs. I don't know what i'm doing, this is getting me aggravated and i've been trying to the past 30 minutes and i cannot figure it out, can someone please help me.

    • @pieterviljoen506
      @pieterviljoen506 4 роки тому +2

      Me 2 im getting so angry

    • @fishfiletfan4873
      @fishfiletfan4873 4 роки тому

      Same

    • @zeiadayman3000
      @zeiadayman3000 4 роки тому

      @@fishfiletfan4873 me too

    • @angrysmoli
      @angrysmoli 4 роки тому +4

      like when you type in the 'public transform player' code it wont put the player option in main camera? cuz thats happening to me

    • @theimpx7965
      @theimpx7965 4 роки тому

      I am having this issue, did you ever find a solution?

  • @LUMINA3
    @LUMINA3 4 роки тому +37

    When I saw the title, I wanted to try to do it before watching...
    *A N D I T W O R K E D*
    wait actually nvm i was doing the game object way ;-;

  • @forevermovies655
    @forevermovies655 9 місяців тому

    You are the best unity tutor in the universe! NGL!

  • @AngelRodriguez-hs7bc
    @AngelRodriguez-hs7bc 4 роки тому +1

    This is very helpful! I appreciate the details you put out in the video, it was very informative!

  • @ajaydubey304
    @ajaydubey304 5 років тому +7

    To the people having problem with follow player script... drag and drop follow script to main camera and set offset accordingly.

  • @connerkauffman1874
    @connerkauffman1874 5 років тому +4

    When I change the X and Y and Z of the offset in Unity it moves my character with the camera

  • @parsa8533
    @parsa8533 4 роки тому +1

    Best, most helpful course I have ever undertook ;)

  • @nathanyao3525
    @nathanyao3525 2 роки тому +5

    June 2022, is this video not loading for anyone else?

    • @fodogamer6654
      @fodogamer6654 2 роки тому

      i reupload this on my channel
      ua-cam.com/video/-r7o4UcSKSE/v-deo.html
      you can check it out and continue!