How to make a HIGH SCORE in Unity

Поделиться
HTML-код
  • Опубликовано: 28 мар 2017
  • Let's make a high score!
    ❤️ Donate: www.paypal.com/donate/?hosted...
    ····················································································
    ► Join Discord: / discord
    ♥ Subscribe: bit.ly/1kMekJV
    ● Website: brackeys.com/
    ● Facebook: / brackeys
    ● Twitter: / brackeystweet
    ········································­­·······································­·­····
    Edited by the lovely Sofibab.
    ········································­­·······································­·­····
    ► 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...
    ♪ There For You by: David Cutter Music - www.davidcuttermusic.co.uk

Комментарии • 431

  • @Brackeys
    @Brackeys  7 лет назад +195

    Hey everyone! Glad that you guys like the video :)
    Some of you are asking about security. Now PlayerPrefs is in no way secure. It is easy to read and modify values if you know what to search for. Of course you can do your own encryption before storing data through PlayerPrefs but I just found this free Asset Store plugin that works in pretty much the same way as PlayerPrefs but with encryption: www.assetstore.unity3d.com/#!/content/32357
    Hope that was useful to you :)

    • @drowsy5384
      @drowsy5384 7 лет назад +2

      Brackeys encryption would be much easier with BinaryFormatter or XmlSerializer (I really prefer the first one) and also it's impossible to store anything but strings ints and float with playerprefs

    • @commentcommenter4198
      @commentcommenter4198 7 лет назад +1

      Brackeys Hey brackeys. I really love your new tutorials! They are much shorter and understandable than your older ones?
      Will there be a chance of you making a new tutorial for a 2d platformer?
      I'm not fond of the old tutorials because of their length and I don't like your teaching style before.
      I'm also really glad you speak less inconsistently with no more "uhhh" in the vids

    • @Blackthornprod
      @Blackthornprod 6 лет назад +10

      You can also add bools with player prefs :)

    • @gempio2634
      @gempio2634 4 года назад

      @@drowsy5384 If you can store strings, you can store serialized data like jsons or xml.

    • @noghost6797
      @noghost6797 3 года назад

      Dude. I don't know how i adding Numbers. I mean *plus* . It's not working, and was to ask you in the comment seqtion.

  • @peterpeperoni7102
    @peterpeperoni7102 4 года назад +870

    The real question is: How did Brackey learn to code when there were no Brackeys videos?

    • @rahulsbhatt
      @rahulsbhatt 4 года назад +123

      Top 10 questions scientists couldn't find an answer to.

    • @akashroy4747
      @akashroy4747 3 года назад +20

      documentation and documentation

    • @VioletDolphin
      @VioletDolphin 3 года назад +44

      Maybe He already knows C## before he was born...

    • @VioletDolphin
      @VioletDolphin 3 года назад

      @@informalmods6044 LMAO

    • @TheAlphaTeamPlays
      @TheAlphaTeamPlays 3 года назад +21

      Brackets invented code

  • @Dragonhawk232
    @Dragonhawk232 Год назад +46

    This is years later but in case anyone else is going through this old playlist learning unity, my unity by default uses TextMeshPro instead of regular Unity text, so a slight change I had to do within the Dice script was adding
    "using TMPro;"
    and then instead of a regular Text class you do "public TextMeshProUGUI score;"
    might save someone else the time I had to spend googling :)

    • @Dragonhawk232
      @Dragonhawk232 Год назад +2

      same thing with the highscore, had to do "public TextMeshProUGUI highscore;" to get it to let me slot the TMP into the component

    • @BDL_CHANNEL
      @BDL_CHANNEL Год назад +1

      @@Dragonhawk232 Thank you very much sir!

    • @b1llspc
      @b1llspc Год назад

      Bless. Just had this same issue, wish I saw this first lol

    • @nirajtoysworld905
      @nirajtoysworld905 Месяц назад

      yah

  • @wehh1
    @wehh1 7 лет назад +256

    "I like living in the edge so ill just do delete all" - Brackeys 2017

  • @gaycat599
    @gaycat599 3 года назад +186

    Why do people give dislikes?!!
    This is literally FREE education!!!!!

    • @dev.prateek5781
      @dev.prateek5781 3 года назад +12

      jealousy, i guess ?

    • @K0BRAKID
      @K0BRAKID 3 года назад +4

      I was expecting a tutorial on how to save it to disk for the next time I launch the game. But his dance at the end made me take back my dislike into a like. Honestly I love this dude I couldnt dislike his video.

    • @ZingarolhoGamer
      @ZingarolhoGamer 3 года назад +6

      @@K0BRAKID but this is exactly it lol

    • @BrentMurrell
      @BrentMurrell 3 года назад +6

      Dislikes don't always mean someone didn't like the video. I think people often use the thumbs down to tell RUclips what they are interested in when new videos are suggested or autoplayed. Because of that, I think a certain number of thumbs downs are unavoidable.

    • @mossupergamer1912
      @mossupergamer1912 3 года назад +3

      H -Having
      A - Anger
      T - Toward
      E - Everyone
      R - Reaching
      S - Success
      ^ That's why

  • @Mikewar1230
    @Mikewar1230 3 года назад +2

    I just subscribed because 4/5 times when I am looking for a tutorial or explanation on something, your video shows up first and it's almost always the most brief but concise tutorial out there. Thanks man.

  • @trill9341
    @trill9341 7 лет назад +207

    I was just about to go to bed....but who needs sleep. Love your videos btw, you are helping me fullfil my dream

    • @Brackeys
      @Brackeys  7 лет назад +24

      Thanks a lot man! Glad I can help :)

    • @moric4677
      @moric4677 5 лет назад

      @james matthews HUG

    • @parthudawant7015
      @parthudawant7015 4 года назад +3

      @@Brackeys Can you please tell about the resources you used to learn game development or some of the best books that must be read to learn game development and to achieve such great expertise like you have achieved ? Please reply!! Keep up the good work!👍

  • @tristanarnold232
    @tristanarnold232 6 лет назад +1

    Thank you for all your videos!
    I am new to game development and you are really helping me learn fast. I am able to quickly learn core concepts, then experiment and expand on my own.
    Very well put together!

  • @benjaminmartinez4159
    @benjaminmartinez4159 4 года назад +1

    Thank you sooo much! I looked at other places for this information, but you're the only one who gave it out so simply.

  • @GameOver7853
    @GameOver7853 7 лет назад +131

    That ending tho

  • @shazwanabdullah9276
    @shazwanabdullah9276 3 года назад

    Thanks Again Brackey’s. You bring inspiration to all of us 🙌🏽

  • @pruthvi4703
    @pruthvi4703 3 года назад

    Thanks Brackeys, this always helps me out when I'm struggling to make a high score feature.

  • @gamedev_navneet
    @gamedev_navneet 3 года назад +1

    Brackeys always makes me understand things very simple. Thank you.

  • @forexalised9053
    @forexalised9053 6 лет назад +2

    I changed my UI view to world space (was messing around) and rotated the UI and made it look all 3D :)
    Made the button a PNG of a Dice and added animations to the button to make it grow slightly larger on highlight, be slightly smaller on click/click hold.
    All in all, your tutorials are amazing and through them, I've been introduced to being finally able to just mess around with Unity and code :)

  • @jacedaniels1812
    @jacedaniels1812 5 лет назад

    Dude you have no idea how helpful and easy to learn this was! Thanks alot! Cheers!

  • @Doctrine60
    @Doctrine60 5 лет назад +18

    Who does not smile while watching Brackey's Tutorials.....this guy is awesome.

  • @Kusaji
    @Kusaji 5 лет назад

    Great explanation of PlayerPrefs and how to use them. Thank you.

  • @matheusmachado5038
    @matheusmachado5038 7 лет назад +24

    Just what I needed! (read in Mario's voice)

  • @yoctometric
    @yoctometric 6 лет назад +4

    your tutorials are the perfect mix of learning from mistakes, quick comedy that adds to learning instead of taking away, and concise teaching. You have this down to an art, and I can't thank you enough

  • @mammut4264
    @mammut4264 6 лет назад

    Your videos have helped me alot. I am almost done with my second prototype now!

  • @mu6tu4e
    @mu6tu4e 7 лет назад

    Awesome tutorial man.
    Thank you!

  • @eze-cs
    @eze-cs 5 лет назад +4

    Good tutorial! If you are making a larger game though, you may want to use encrypted or binary variables,
    but this is great for quickly making highscores!

  • @Term1nus3st
    @Term1nus3st 4 года назад +1

    This is great for saving sensitivity in mobile apps. Thanks a lot

  • @funkymonkey15963
    @funkymonkey15963 4 года назад

    It's taken me days to get thru this series and then onto this vid. troubleshooting and the like cause Im kinda slow. but man it was all worth it to see Brackey do that little jig at the end!

  • @CarlosHasAIdea
    @CarlosHasAIdea 4 года назад

    man really enjoy your vids

  • @thefallenlime
    @thefallenlime 2 года назад

    This was by far the easiest video to follow for this. Thanks a ton!

  • @Moshugaani
    @Moshugaani 4 года назад

    Thank you very much! It was quite simple in the end.

  • @valdak5277
    @valdak5277 3 месяца назад

    Thanks a lot, this was really helpful even 6 years later!

  • @wannaberickistevens
    @wannaberickistevens 3 года назад

    such an amazing video. has everything i needed.thanks!!

  • @hjc1710
    @hjc1710 4 года назад

    My man! Another great tutorial.

  • @kgibbsy
    @kgibbsy 4 года назад

    This is exactly what I'm looking for. I need a very simple level unlock system an I can amend this script slightly for that exact purpose. Thanks Brackeys!

  • @peeei7423
    @peeei7423 3 года назад +1

    this man makes me feel so smart with his tutorials, thx and goodbye brackeys

  • @Rob-fi2pe
    @Rob-fi2pe Год назад

    You are a life saver! I knew WHAT I needed to do but you showed me HOW. Thank you, thank you, thank you!

  • @hansaldrinantonio1331
    @hansaldrinantonio1331 6 лет назад +1

    Thanks Brackeys!!

  • @george9973
    @george9973 6 лет назад +1

    Great tutorial! Thanks

  • @sinakamali3297
    @sinakamali3297 5 лет назад +1

    Best instructor EVER!!!

  • @impheris
    @impheris 5 лет назад

    Bro, you Are Amazing... keep your work...

  • @user-gs3vn3yv3e
    @user-gs3vn3yv3e 3 года назад

    Thanks legend, realy helped with my first game, hope you come backone day

  • @Pottsy
    @Pottsy 7 лет назад

    Great Tutorial man!

  • @gabrielesimoni6684
    @gabrielesimoni6684 4 года назад

    thank you! very clear tutorial

  • @jb9480
    @jb9480 Год назад

    Thank you so muck for all your great videos

  • @SpeedirX
    @SpeedirX 6 лет назад

    I love you man!!! Best tutorials ever! Hugs for you!

    • @calebvonweichardt7785
      @calebvonweichardt7785 3 года назад

      HUG HUG HUG HUG HUG HUG HUG HUG HUG HUG HUG HUG HUG HUG HUG HUG HUG HUG HUG HUG HUG HUG HUG HUG

  • @SmartBunnyTuts
    @SmartBunnyTuts 5 лет назад

    Thanks a lot........Finally I Understand this High Score
    thank you Sooo much!

  • @victorfranky2245
    @victorfranky2245 3 года назад

    Thank you so much, this helped me alot! 👍👍

  • @lassewierowski1947
    @lassewierowski1947 3 года назад

    Thanks brackeys that was very helpfull!

  • @V.Z.69
    @V.Z.69 3 года назад

    Thank you! I should have started learning Unity a long time ago. Losing AS3 on Flash was a huge setback for development solitary developers like myself. Back on the horse to make some extra income!

  • @neckudart272
    @neckudart272 6 лет назад +4

    this is the best unity channel ever .

  • @vaibhav4215
    @vaibhav4215 Год назад

    Thank you so much ❤

  • @foreducation408
    @foreducation408 2 года назад

    this is soo awesome, I was searching for a way to implement the high score feature in my game, this one helped me.

    • @dcry1003
      @dcry1003 2 года назад

      hey i have a question, when using playerprefs does the highscore also get saved *(it still gets displayed in the chosen UI text)* when you exit your game and enter again?

    • @foreducation408
      @foreducation408 Год назад

      @@dcry1003 yes

  • @khankhalik2188
    @khankhalik2188 5 лет назад

    Superb dance in the end!

  • @MoshiGamePlay
    @MoshiGamePlay 5 лет назад +1

    Great tutorial! How would i go about creating a top 10 personal highscore instead of just 1. I also struggle to carry over my current game score to my game over screen. Thanful for any sort of guidance.

  • @blind_neighbourhoodNerd
    @blind_neighbourhoodNerd 5 лет назад

    Thankyou so much!

  • @aryamansingh8826
    @aryamansingh8826 5 лет назад

    exactly what I was looking for

  • @dealvik
    @dealvik 7 лет назад

    I like the short tutorials and all, but I really wish that Brackeys would make a game tutorial series's like he used to.

  • @braindamagecontent
    @braindamagecontent Год назад

    it's been more than two years...
    brackeys is still coming in clutch lmao

  • @curt7167
    @curt7167 7 лет назад +1

    thx for shared!

  • @dp6501
    @dp6501 6 лет назад

    Thank You very much, you helped me a lot

  • @Oxmond
    @Oxmond 4 года назад +1

    Sweet! Great tutorial! ...and awesome DANCING! 👍🤓🧡

  • @mirianchavchavadze7494
    @mirianchavchavadze7494 4 года назад +1

    That ending :D lovely.

  • @harshalsingh7567
    @harshalsingh7567 6 лет назад +1

    great video, nice dance too

  • @lucaazogamer5511
    @lucaazogamer5511 4 года назад

    Thank you!

  • @toonzelda3353
    @toonzelda3353 Год назад

    Your video helped me out with a Unity assignment where I had to get the best race time :). I used exactly your algorithm and it helped me out! I don't know if you will see this comment Brackey's but thank you. You won't believe how much your videos have impact me and many others studying gamedev.

  • @hasankemalturk4416
    @hasankemalturk4416 3 года назад

    Thank you bro :)

  • @robinchmelik2522
    @robinchmelik2522 6 лет назад +1

    Thank you very much. Save a lot of time...

  • @adamsabdulmajid9543
    @adamsabdulmajid9543 6 лет назад +1

    you are the best...thanks

  • @tadeuvi
    @tadeuvi 6 лет назад

    I love this man

  • @omarjribi5687
    @omarjribi5687 6 лет назад

    thanks brackeys , would you please make a tutorial about leaderboard !

  • @tesil123
    @tesil123 7 лет назад

    As always video! Could you make one about damage text popup? Have the damage popup when you hit the enemy in the tower defense game.

  • @mracipayam
    @mracipayam 3 года назад

    You are my hero man

  • @Capnarchie
    @Capnarchie 7 лет назад +14

    when do we get multiplayer ingame chat tutorial for games

  • @DevRightms
    @DevRightms 7 лет назад +20

    whooo ! that dance at the end
    made my day ;)

    • @ShirshKhandeliaSKJ
      @ShirshKhandeliaSKJ 4 года назад

      I literally was paused just before it to read the comments, and went back to see the "dance at the end". It hit me right in the face! 😂😂😂

  • @GuilhermeAkuro
    @GuilhermeAkuro 7 лет назад +1

    great video thx

  • @santoshpss
    @santoshpss 5 лет назад +2

    I really like your forced smile in every video :)
    Edit: I really do, it really makes the video more enjoyable, but don’t force yourself :)

  • @aleksandarvagner9826
    @aleksandarvagner9826 7 лет назад +81

    Will you please make a leaderboard tutorial?

    • @seunn
      @seunn 7 лет назад +2

      yaaa

    • @jole0
      @jole0 7 лет назад +1

      Richard Wagner Then you need to connect your game to for example Google Play services

    • @LoadX321
      @LoadX321 7 лет назад +6

      not really, you could have a leader-board like that on arcade machines.

    • @Illu07
      @Illu07 7 лет назад +9

      Sebastian Lague has a great Leaderboard tutorial for unity. Check it out.

    • @ResoCoder
      @ResoCoder 7 лет назад +1

      Really the best thing you can do (at least when targeting Android) is to use Google Play Games Services. It's simple and awesome!

  • @EdwardTutorials
    @EdwardTutorials 6 лет назад

    thanks sir!!!

  • @EndexPlay
    @EndexPlay 4 года назад +1

    great video!

  • @TacticsTv
    @TacticsTv 7 лет назад +1

    Nice video 🔥👌

  • @BerkinAkkaya
    @BerkinAkkaya 6 лет назад +2

    is DeleteAll() function deletes all of the keys in scene or all the game ? Thanks :)

  • @Alexander_Meyer
    @Alexander_Meyer 6 лет назад

    Thank you so much, always good videos. I tried having a ScoreManager that gets refered to, but that was a royal pain to get to work.. This is much simpler..!

  • @vpeter56
    @vpeter56 3 года назад

    Anytime you find a Brackeys video, you know you feel safe with your last minute projects.

  • @epiuw3157
    @epiuw3157 7 лет назад

    Hi I'm a french young beginner in programming. Does it a good idea to make saves with "PlayerPrefs" or it's just for little variables ? What are the differences between the different way to makes saves ?
    By the way, such a beatifull video, you help me so much ! Lovely regards.

  • @hahahpizza
    @hahahpizza 6 лет назад +1

    This is so neat and simple, thanks.
    One thing I wanna ask is, What if I want the prefix before the text like this:
    High Score: "the PlayerPrefs value".

    • @zinebhalwi7510
      @zinebhalwi7510 6 лет назад +4

      then you should put this code inside the for function:
      PlayerPrefs.SetInt ("HightScore", number);
      highscore.text = "Hight score : " + number;

    • @rakharuan
      @rakharuan 3 года назад

      @@zinebhalwi7510 and .ToString()

  • @jasminabadiyani9635
    @jasminabadiyani9635 5 лет назад

    good explanation

  • @HowzeBase
    @HowzeBase 6 лет назад

    Fantastic!

  • @atlasthetitan5110
    @atlasthetitan5110 7 лет назад

    Could you make a video on how to move a game object back to a certain position

  • @Koning_Chiel_de_Eerste_RCC
    @Koning_Chiel_de_Eerste_RCC 6 лет назад +15

    Hey,
    Great Video !
    I have a question... how can i apply this to another Scene so that i get the Score of the previous scene?

    • @nathannorris2595
      @nathannorris2595 5 лет назад +12

      First you need a "Game Manager" script... Second, you need to put everything you want to be carried over to the next scene under it. Create an empty game object and call it "Game Manager" Put your game manager script on that. Then place everything not to be destroyed there. Then you need to add this code:
      void Awake()
      {
      DontDestroyOnLoad(transform.gameObject);
      if (FindObjectsOfType(GetType()).Length > 1)
      {
      Destroy(gameObject);
      }
      }
      However, this will make duplicates so we are going to delete the original and keep the copy by deleting with a length greater than 1. You can find tutorials on this but you are more than welcome to use my code :)

    • @migouchegr4882
      @migouchegr4882 5 лет назад +3

      use a static variable

    • @stejothepisto
      @stejothepisto 4 года назад +1

      Did you solve this? lol I cant find anything about it ...

  • @jihadpurnomo5744
    @jihadpurnomo5744 Год назад

    thank you

  • @foongming381
    @foongming381 Год назад

    Tq it is helpful

  • @1lsgaming27
    @1lsgaming27 6 лет назад

    I think Unity should recruit brackeys for those unite speeches they have at those conentions or whatever they are called because he is a pro at this. I learned alot from the vids keep it up👍👍👍👍👍

  • @divsyntax9720
    @divsyntax9720 3 года назад +1

    These "Playerprefs" remind me of Android "SharedPrefs" and just as easy. Thanks! :)

  • @periklisvairaktaridis132
    @periklisvairaktaridis132 5 лет назад

    Please make a video about saving stats using JSON

  • @lib4861
    @lib4861 3 года назад

    Thanks is Work

  • @vulpesvulpes1557
    @vulpesvulpes1557 7 лет назад +4

    Hi Brackeys can you make video about character animation(walking aiming running) and weapon menu selection Pls.
    Sorry for bad English

    • @Victor-oo4ux
      @Victor-oo4ux 6 лет назад

      Look his RPG series. :D Here he shows almost all

  • @ZeroSleap
    @ZeroSleap 6 лет назад +1

    Question,isn't it more convenient in our case(handling text objects,as strings) to use .GetString instead of .GetInt?

  • @marcinbiaecki9731
    @marcinbiaecki9731 3 года назад

    Thank you :)

  • @philunityunreal7228
    @philunityunreal7228 4 года назад

    I have a question about "PlayerPrefs" . I lean from this video that it is skillfull for the highscore by saving int, float, etc by using PlayerPref.SetInt, PlayerPref.SetFloat, etc. Is it a way to do the same for an array? (int[ ] tab) Thanks for your attention and greetings.

  • @TheMuziekLeven
    @TheMuziekLeven 7 лет назад +1

    how can i implement this in multiple game level ?
    I use the same score script for the levels because its a time trial score system but now that i have used this video to add a highscore to this i get (ofcourse) the same highscore in the levels. do i need to seperate all the score systems per level or is there an easy way to fix?

  • @SubhanshuThapa
    @SubhanshuThapa 7 лет назад

    Thank You So Much For The Logic. :-)

  • @WikiteTV
    @WikiteTV Год назад

    Thanks

  • @bip901
    @bip901 6 лет назад +1

    1:36 both Unity wiki and this little popup box says that the max number *is* INCLUSIVE...