SCORE & UI - How to make a Video Game in Unity (E07)

Поділитися
Вставка
  • Опубліковано 22 лис 2024

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

  • @tamirrozenfeld3572
    @tamirrozenfeld3572 2 роки тому +250

    For who's having problem pulling component on 7:46, u should write public TextMeshProUGUI scoreText; instead of public text and than u will be able to pull component.

    • @icicle466
      @icicle466 Рік тому +7

      i tried this but for me it says it couldn't be found what should i do?

    • @dementi5100
      @dementi5100 Рік тому +5

      ​@@tristanfp4887 at the top of the code

    • @mdszirgun8715
      @mdszirgun8715 Рік тому +2

      hello, still dosn't work... any other advice?

    • @AbhijitBalaji-rw1kj
      @AbhijitBalaji-rw1kj Рік тому +3

      @@tristanfp4887 Thank you so much!!!

    • @Mihai_r4
      @Mihai_r4 Рік тому +1

      Thx

  • @niallpeel7832
    @niallpeel7832 Рік тому +55

    4:02 Brackeys adds a font by simply dragging into the project tab. If you are using TMP (Text mesh pro) you first have to create the font asset by going to Window>TextMeshPro>FontAssetCreator and then drag the font to the Source Font File. From there when you go to select the font to use you can find it in the pop out window as Brackeys does

  • @wiktortofil9149
    @wiktortofil9149 6 років тому +1174

    "Anything but Arial". Let's go with Comic Sans.

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

    Tutorial : "How can a 9 minutes video take 2 hours of your time to finish watching it ?"

    • @HealthyWC-2
      @HealthyWC-2 5 років тому +462

      "Only 9 minutes?" Psh, coding is easy... "Wait, let me copy that code real qucik and pause the video" "Oh shoot, I got some errors in my code, AGGH I DON'T KNOW HOW TO FIX IT, I SUCK AT PROGRAMMING and I don't understand any of the answers online.... OH I GET IT NOW" "Where is that button located in Unity? I DON'T KNOW WHERE IT IS... found it" "Hm... I have some errors again but its look correct, ohhh I misspelled Transform, it was transfomr, silly me" This should cover your reasons. ;)

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

      Lmao

    • @TimM-kz1vl
      @TimM-kz1vl 5 років тому +38

      @@HealthyWC-2 Protip: save a backup of your script if you like to occasionally experiment like I do.

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

      it's 9.07

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

      @@ivonedev9658 who the fuck care

  • @willpetillo1189
    @willpetillo1189 4 роки тому +340

    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: Improving project organization
    0:34: Improving collision detection
    1:27: Creating on-screen text
    2:49: Scaling text with screen size
    3:38: Downloading a new font and applying it to text
    4:21: Getting player Z position
    6:00: Updating on-screen text
    7:45: Formatting text to display as whole numbers

  • @krky
    @krky 7 років тому +366

    Thank you for not only this video but also your all Unity Tutorial videos.

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

      You're welcome ;)

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

      @@Xmsnjeje evet yapabildim, google play store'da yayınladım fakat güncellemediim için oyunlarım silindi malesef.

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

      I agree with this comment. I was just someone who didn't know anything abt making games other than scratch but I had a passion and now I'm working on my first game with only tutorials I found on this channel. Thank you so much.

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

      My player not moving, help!

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

      @@krky I dont speak turkish but ne denir?

  • @spacemonkeyspiff
    @spacemonkeyspiff Рік тому +83

    For those who are using TextMeshPro instead of the legacy text, make sure to include the namespace for textmeshpro, which is TMPro (so include the line of using TMPro; at the beginning of your code). Also instead of using public text, use public TextMeshProUGUI

    • @Therealdot
      @Therealdot Рік тому +1

      Thank You

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

      wdym

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

      @@JellyGang680 In this tutorial, Brackeys uses legacy text as this video is 6 years old and I believe TextMeshPro was not a proper feature in Unity. Now, we can use TextMeshPro which I believe is more customizable and easier to use. For your score script, you need to add a using tag for TMPro, or else you will face errors.

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

      Thank you so much

    • @kuinkyo7292
      @kuinkyo7292 Рік тому +2

      I used this but I’m still getting an error does anyone know how to fix this?

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

    Dude I know this is a very late comment but you're the best. After this tutorial specifically I used the methods from EVERYTHING you taught me and I made it so that the score stopped on a collision, its a small thing but i felt so proud that I did it myself from what i learned from you. THANK YOU!

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

      I'm happy 4 you! :)

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

      Noice

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

      can you plz give the code i have been trying for 2 hours and i still cant get it done

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

      @@reaperplays4170 On the collision script, add "public score theScore" as a variable and in the if statement, add "theScore.enable = false" and link up the text to "theScore".

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

      well done bro

  • @simonvutov7575
    @simonvutov7575 6 місяців тому +2

    I watched this video 5 years ago when I was starting out learning to code. It's increadible how much the world has changed since then.

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

    3:52 Red_Communist_Party.jpg
    what

  • @RadioactiveGamin
    @RadioactiveGamin 7 років тому +228

    I disable my ad-block for this channel as you do these videos pretty much for free, and you've motivated me in the past. Now I know a decent amount of C# and I got a little bit of experience with Unity thanks to your previous tutorials. Just nowadays I can't find the motivation to continue when I need it most :/

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

      I'm glad to have helped :) For motivation I recommend forum.brackeys.com/ or this discord chat discordapp.com/channels/243005537342586880/243005537342586880 :) Good luck!

    • @AngelRodriguez-hs7bc
      @AngelRodriguez-hs7bc 5 років тому +28

      A lot of jobs are using Unity, and C#. If you need motivation - think of your potential career.

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

      @@Brackeys thank you for making these tutorials . can you make a tutorial on making a game like ninja stick but in 3d please.

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

      @@Brackeys i dont know how to put z in the Debug.Log?

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

      My player not moving, help!

  • @zendox
    @zendox 2 роки тому +74

    if you're doing this in 2022, there's an easy solution, you can still get the old text without using text mesh pro
    go into the game object tab at the top, then UI, then you should see legacy at the bottom. if you go into it you should see text.
    then follow the rest of the tutorial like usual, if you get stuck you can use the code below, or use the debug mode that brackeys showed
    using UnityEngine;
    using UnityEngine.UI;
    public class Score : MonoBehaviour
    {
    public Transform player;
    public Text scoreText;
    void Update()
    {
    scoreText.text = player.position.z.ToString();
    }

  • @sedotan2
    @sedotan2 7 років тому +20

    OMG, i just got assignment from my college to make an UI in Unity and you upload this video. Thanks B!

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

      Also check out how he did the UI in the tower defense series, it looks really cool

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

    This guy gives free education man....... soo cool, online crash courses take $200 and the quality here is better than them. Hats off to u bruh, keep it up.

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

    Brackeys: The only UA-camr you don't have to crank up the playback speed for. These videos are really dense with material. I appreciate that.

  • @OmarMohamed-tn8es
    @OmarMohamed-tn8es 4 роки тому +181

    For anyone didn't set player start z position to 0.
    Make an int equal to the player start position like( int x = - 55;)
    Then
    ScoreText. text = (Player. Position. z+x). Tostring("0")

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

      Thanks. What if I want to divide it. I'm starting on 40 and I want it to give me a point every 50 starting from z = 50

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

      Thanks

    • @OmarMohamed-tn8es
      @OmarMohamed-tn8es 4 роки тому +1

      @Wowkoby That mean something wrong in your code text make sure you wrote it correctly and you didn't miss semicolon or send me your code so i can help

    • @Z18-i3n
      @Z18-i3n 4 роки тому +2

      For those who have the position with decimal number use float

    • @OmarMohamed-tn8es
      @OmarMohamed-tn8es 4 роки тому +2

      @Alessandro Bova 7:32 in the script

  • @ath.bar.7671
    @ath.bar.7671 3 роки тому +24

    For those who don't have their starting position at Z 0, I made something to make it easier:
    1. Add a public float variable called "initialZ"
    2. Add a void Start() method (if you removed it)
    3. Inside it, add "initialZ = player.position.z" (replace "player" with what you named your player)
    4. On the top of the Update() method, add the following: "float newZ = plr.position.z - initialZ;"
    5. Replace "player.position.z.ToString()" (where you change your text) with "newZ.ToString()"
    Your score will now start from 0 instead of minus something.

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

      thanks

    • @SwirlY-sTrAw
      @SwirlY-sTrAw 2 роки тому

      thank you for this

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

      Thank you

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

      plz somone give me the full code for copy i have 2 error that saying:
      1. Assets\Scripts\Score.cs(14,18): error CS0236: A field initializer cannot reference the non-static field, method, or property 'Score.player
      2.Assets\Scripts\Score.cs(14,38): error CS0236: A field initializer cannot reference the non-static field, method, or property 'Score.initialZ'
      my code is:
      using UnityEngine;
      using UnityEngine.UI;
      public class Score : MonoBehaviour
      {
      public Transform player;
      public Text scoreText;
      public float initialZ;
      void Start()
      {
      initialZ = player.position.z;
      }
      float newZ = player.position.z - initialZ;
      void Update()
      {
      scoreText.text = newZ.ToString();

      }
      }

    • @haisepaneer
      @haisepaneer 12 днів тому

      @@ccaudiolibrary3309 you did not add the void update ()

  • @smitaparida7847
    @smitaparida7847 4 роки тому +211

    Nobody:
    Literally Nobody:
    ME: Playing my own game for 8 hours straight.

    • @cosmic2750
      @cosmic2750 3 роки тому +18

      i sympathize, and i kind of feel its that way because we're proud of our first project :)

    • @peeei7423
      @peeei7423 3 роки тому +5

      same here buddy

    • @otmanesajid426
      @otmanesajid426 3 роки тому +3

      me too xDDD

    • @l_sx8722
      @l_sx8722 3 роки тому +8

      and the best thing is we are the "god" of our game, whenever we feel something needs to change, we change that

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

      @@l_sx8722 yeh 😁

  • @mossaabtoualia8198
    @mossaabtoualia8198 3 роки тому +58

    BUG FIX: For all of you who got an exception "The namespace '' already contains a definition...": Check if you have some of the script files in the Assets folder as well as in the scripts folder.
    If so, make sure the ones in the Scripts folder are updated and delete the ones in the Assets folder.
    This might have happened if you had the scripts open while moving them to the Scripts folder.
    It worked for me, hope it worked for you :)
    i found a this on the ep 8 i hope it work

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

      omfg thanks soooo much ur a lifesaver

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

      I wonder why I got that error, in the end i just figured out my script "score" was duplicated by accident. Thanks a lot man you saved me

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

      Bro i will legit give you 10$ for solving that thank you

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

      omg you saved me omg

    • @Sub-zero1123
      @Sub-zero1123 2 роки тому +1

      Thanks a lot man

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

    I might be 4 years late but after 5 useless guides on this topic you just made things so much easier thank you so much

  • @nuggetlord4104
    @nuggetlord4104 3 роки тому +12

    For anyone following this tutorial in 2021 or until they change it, you can add text from GameObject(at the top) -> UI -> Text

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

      ty bro you saved my code i was using the wrong type of text (text tmp)

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

      Or help I can’t find text only mesh pro I can’t put it in the score scprit

  • @journeyingwithchrist22
    @journeyingwithchrist22 2 роки тому +7

    My method of learning is to watch the whole video through, and make notes without pausing it. Then attempting everything from memory, then use my notes to help or end up re-watching parts of the video I got stuck on. That way I feel like I'm doing most the stuff myself.

  • @normanp.chesterton7397
    @normanp.chesterton7397 6 років тому +34

    Another note: Just taking the Z distance works fine in this instance, but if you want to be able to be less constrained in your level design, you would use the distance between the starting vector and the current position, of course.
    The author of this video knows all of this, of course - I am just adding some things that might be useful to the audience.

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

      Yeah he kinda mentioned that

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

      How?

    • @Rodri-gv8uf
      @Rodri-gv8uf 4 роки тому

      @@tomthebigman7481 Guess we'll never know...

    • @Rodri-gv8uf
      @Rodri-gv8uf 4 роки тому +8

      Could you please tell us how it's done? My player is at a negative z position, so the score remains negative. If I could do what you said, I'd be able to fix it.

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

      @@Rodri-gv8uf make the text = to the current position minus the starting position of the cube

  • @Destiny4CODERS
    @Destiny4CODERS Рік тому +1

    I Had Been Copying Every Other UA-camr's Video To Make My Video Game. But Because Of Your Course, I Can Make My Own Game Without Copying Anyone . thank you legend💖💖💖💖

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

    This man is a genuine hero to so many amateur coders

  • @coolFM2001
    @coolFM2001 7 років тому +264

    can you add a respawn mechanic in the next episode please

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

      Working on it ;)

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

      Brackeys yay respawn

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

      how to scale from center on MAC?

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

      He done it in a live for a 2D game i tried and it's work for this

    • @bloodwolf2609
      @bloodwolf2609 6 років тому

      without respawn / boundary the game can get cheesed :O

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

    I'm really enjoying following along to this tutorial! Thanks so much for making these series.
    If you are like me and in the part where we add in scoreText.text = player.position.z.ToString(); code and playtested, you may have had an error in the code. Something along the lines of "variable player of Score is not assigned".
    That is because the script affects the player and the text, so the Text AND the Player get the script. Just uncheck the score script from the Player in inspector and it's good to go.
    Don't be like me and scub through the video and restarting unity many times. Instead, google the answer next time :') Hope this helps!

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

      thank you so much! this helped. the game worked but that error message was really annoying me, Thanks!

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

      that's.... two years ago now you probs figured it out

  • @ashutoshchakravarty2669
    @ashutoshchakravarty2669 6 років тому +12

    This guy explains everything very comprehensively he is a cool good and awesome youtuber.KEEP UP!!

  • @louis-philip
    @louis-philip 4 роки тому +1

    You have no idea how helpful you are... These tuts are gold!

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

    Dani sent me here and i love these tutorials, thanks bracky

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

    Your tutorials are absolutely outstanding! I have learnt so much more about designing and coding games thanks to you! Keep the tutorials up! They are very appreciated. Thanks

  • @ThatOneRobloxDev
    @ThatOneRobloxDev Рік тому +8

    2:39 If you are using Text Mesh Pro, then disable "Wrapping" instead of enabling "Overflow"

  • @iamgod4u907
    @iamgod4u907 2 роки тому +92

    if you are having trouble with adding score in Text (TMP) copy this:
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using TMPro;
    public class Score : MonoBehaviour
    {
    public Transform Player;
    public TextMeshProUGUI scoreText;

    void Update()
    {
    scoreText.text = Player.position.z.ToString("0");
    }
    }

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

      what the using TMPro; do

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

      @@rax0503 use to access text(TMP) object in our script cuz
      public Text scoreText;
      is for legacy text.

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

      @@iamgod4u907 I understand now thanks a lot

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

      You are a legend. Thanks!

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

      @@4everbroke787 😅😂thanx

  • @hey-ef6wv
    @hey-ef6wv 3 роки тому +1

    this guy helped millions of people to start game dev in the lockdown and corona peroid

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

    whenever my friends ask me how to do code, I immediately link them your channel. All of your tutorials are top tier.

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

    keep up currently you are my best UA-camr

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

    I followed this series for 4 consecutive episodes and now im getting game dev ads nonstop xD the "algorithm" works.

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

      same here : )

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

    when ever i expand my game view i cant move my character using A and D but whenever its in default view everything works fine

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

      @@buritto8784 god thank you so much!

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

      You can also use the combination Ctrl + P to start and that way you won't need to click on the screen

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

      @@detyvitanova749 thank u

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

      same issue!! How to figure it out?

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

      @@adityarana7956 click on the game window or click maximise on play

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

    I am watching this during lockdown.
    I am now going to make a game, I also watched all his vids together and I think I can make it to the end of my game. Unity has taught me that 2d games are harder to make.

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

      3D Games would make it the hardest to make for us. Have you finished making your game?

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

    I've made Jumpy Cube game with the help of Brackeys videos. Such a nice guy to share all his skills with us.

  • @iKingOf
    @iKingOf 4 роки тому +184

    Font Size: 69
    I really hope that was intentional.

  • @thelegendarynarwhal7651
    @thelegendarynarwhal7651 4 роки тому +11

    Alright, I see a lot of people have a problem where this error happens "UnassignedReferenceException: The variable Player of Score has not been assigned." And I got this as well. The error is most likely that you forgot to do this part 5:35 and you might have forgotten to do the same with the script. If you still have problems don't be afraid to reply to this comment.

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

      tanks you helped me a lot

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

      I'm having this problem, but i have assigned the player to the variable, im very confused.

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

      I did everyrhing that you said and I still got the error

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

      i have a problem that so that the i dont have the "Player" variable in the "Score" script which prevents me from draging the player into there
      If anyone knows what i could have done wrong please reply with the solution
      i accidentaly closed unity but im going to open it so i can ctrl+c ctrl+v the error message
      edit:Assets\Scripts\Score.cs(5,14): error CS0101: The namespace '' already contains a definition for 'Score'

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

      You are the best kind of human.

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

    Brackeys is simply the best

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

    For a second there, I thought this video was going to be about making a musical score for your game. This makes much more sense.

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

    Is it only me who gets insane satisfaction when you try to guess the next step and it acctually works?

  • @ПавелКрасавчик-т7м
    @ПавелКрасавчик-т7м 3 роки тому +5

    7:42 I am a newbie and I solved this problem my way. Surprisingly, my code works correctly. I decided to leave my decision inside the game, because my own terrible is better than someone else's and beautiful. By the way, here's my code:
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.UI;
    public class Score : MonoBehaviour
    {
    public Transform player;
    public Text scoreText;
    int convertPositionZ = 0;
    void Update()
    {
    convertPositionZ = (int)player.position.z;
    scoreText.text = convertPositionZ.ToString();
    }
    }

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

      well I have a problem converting the int format and your code helped it!! thanks you mate ^^

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

    5:59 "So again we'll go into unity" *proceeds to open visual studio*

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

    7:29 is the part we all come back to every month

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

    The pure joy of seeing those numbers count up! =D

  • @fadelazidan7731
    @fadelazidan7731 8 місяців тому

    am i watching a tutorial from 7 years ago? Yes
    am i happy with it? Hell Yes
    Thank you

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

    -For anyone who wants the score to stop counting when you fail, just change the score script adding
    if (movement.enabled == true)
    {
    scoreText.text = player.position.z.ToString("0");
    }
    -and dont forget the
    "public PlayerMovement movement;"

  • @tuckerkrause5838
    @tuckerkrause5838 7 років тому +61

    1:25 THANK YOU that has been annonying me sonce Ep 1

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

      Ret Zy oh GOD I THOUGHT I WAS THE ONLY ONE!!!

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

      Since*

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

    1:08 I put mine on 8000... it FLEW like a Kamikaze! 0_o
    Loving this series so far, thank you so much 4 making it ^^

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

      reenact 9/11

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

      I had the same problem, then I realise I messed with the Time Manager without realising.

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

      @@starman4346 LMFAOOOOO

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

      @@xord1946 Well, glad you got it fixed tho! :D

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

    These videos are great, nice quick pace but you seem to get the most important details in there. Can't wait to try this stuff out!!!

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

    I also add the y and x position to score. Worked perfectly.

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

    If anyone wants to disable the text, and then enable it on start up.
    Go into your Score script, make a Start() method and put score.enabled = true; This text controls the little checkbox besides the Text element, where you probably typed 250.
    Then, go to your text element, in the text object, and disable it, and on start up, it should appear.
    If you want to keep it enabled, and leave it there, obviously just change the text to 0.

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

      Mech I need help and since this is an old video I though my best shot was to reply to someone, and you seem like you know what you’re doing. When I was trying to get the text to work it suddenly got really low quality and won’t go to a size over 27. I’m not sure how to fix it, please help.

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

      @@skittlebread41 I completely forgot how to code, I'm sorry. I dropped off and I need to learn it again. I don't even understand what I'm saying in my own text.

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

    Hi! If you using the Text Mesh Pro, just add this on "using":
    using TMPro;
    then:
    public TextMeshProUGUI scoreText;

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

      god thank you so much man, was thinking why it wasn't working

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

      You're the best

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

      Helps a lot

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

      How can I use Text Mesh Pro? Should I download it or is it included in the Unity editor?

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

      i had this problem too

  • @JustAhmed_yt
    @JustAhmed_yt Рік тому +5

    People who dont find "Text" but who find "Text meshpro" The text UI thing is in "legacy"

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

      no prob3 people liking this + myself Xd

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

    I think this was the easiest one to follow, I’m glad UI is easier than I thought

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

    Once I will end this course I will 100% leave a donation on your website, this channel is extremely helpful

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

    For those whose text is missing when font size is too big, just increase the text area

  • @Kabatemasmusic
    @Kabatemasmusic 7 років тому +11

    appreciate that you speed up your videos by cutting the parts without speed. but I think it went too fast ;)

  • @Faris._.
    @Faris._. 5 років тому +38

    in case anyone faced a problem where the player is SO fast and skip through every obstacle , its because you put the time step at 0.1 instead of 0.01. just in case :)

    • @OK-ps2vz
      @OK-ps2vz 5 років тому

      I decided to play test, and suddenly, my player/cube was able to go past the obstacles. It physically made contact with the obstacle, but it would just speed past it, and my movement would keep going on. Have you experienced this?

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

      i am having that problem, where do i go to change that value?

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

      @@MichaelSalton go to edit at the top left and at the bottom it says project settings then there's a tab called time you go to and its called fixed timestep

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

      ​@@roboticreviewer9159 It wont let me edit the fixed Timestep

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

      I go to edit. Then hit project settings. then a tab pops up. then i go to time. then you cant edit anything.

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

    These videos have been the greatest! Thank you so much for making them! You present stuff in a way that's extremely friendly to beginners and you manage to not linger on a bunch of small stuff at the same time. You are awesome!

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

    ive been trying to make a game for so long but didnt know how to do it , then i found this, thank you.

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

    Dude, you're amazing. Thank you for sharing this info.

  • @TimM-kz1vl
    @TimM-kz1vl 5 років тому +5

    My notes so you don't have to rewatch the vid. Make a folder for your scripts and materials.
    Occasionally, you’ll pass through objects. Under your Rigidbody component, set the Collision Detection to continuous.
    Then edit>project settings>time and set the Fixed Timestep to 0.01 This tells Unity to more frequently update our physics.
    For UI, create new object, UI, and text.
    Switch to 2D mode
    It creates a canvas, which is the game’s way of categorizing all UI elements. This canvas is 2D.
    Canvas will be in center of screen. Change Horizontal Overflow to Overflow so your text will keep going.
    Click on canvas and change UI Scale Mode from Constant Pixel Size (text doesn’t resize) to Scale With Screen Size.
    For more fonts, download them as a zip, then drag and drop into your assets.
    New script called Score
    using UnityEngine;
    using UnityEngine.UI;

    public class Score : MonoBehavior {
    public Transform player; //location and rotation of an object named player
    public Text scoreText;

    void Update() {
    Debug.Log(player.position.z); //Then drag player object into script. You can get rid of this line if you want.

    scoreText.text = player.position.z.ToString(“0”); //allows you to change the text content.
    //player.position.z will throw an error that a float has to be converted to a string which is what ToString is for. ToString(“0”) rounds it up to the nearest whole number.
    }

    }

  • @normanp.chesterton7397
    @normanp.chesterton7397 6 років тому +5

    Here we can see a good example of how to decide whether to use Update or UpdateFixed. UpdateFixed would have updated the score independently of the frame rate. But, because it probably doesn't make sense to update the scoreboard faster than we can draw a frame, it makes more sense to use Update. In this case, according to the Unity documentation, UpdateLate, I think, would be the most appropriate place, because we can or should probably draw our score after the frame is done drawing.

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

    dude THANK YOU
    I was getting crazy trying to make a text prefab update a text on screen (surprise! it didn't work) so I watched your video and BAM. it works like a charm now. Thanks!

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

    Thank you. You inspired me to learn to program and make games but most importantly you taught me how to do it. I hope you are doing fantastic cuz you are a really good person

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

    I am a big fan of yours.
    Can you teach to carry score from one level to next level,please

  • @maximilianosierralta589
    @maximilianosierralta589 3 роки тому +8

    Guys, for everyone that has problems with the text not showing when you're in game mode / maximize, in the text remember we put the horizontal to overflow? put the vertical too!

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

    Save Often! Getting far enough along in the series that I want to try other things. Unity crashed on me and I lost at least an hour of work. (Could have been worse!) Lesson learned, Lesson shared.

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

      There are two types of people that use computers:
      1. Those who already lost data due to not saving
      2. Those who yet have to

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

      Ctrl+S is something that should be made second nature while working on projects. Saves me a world of annoyance when something crashes.

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

    To anyone watching this in 2022, select "text legacy" when making the text. You would find it under UI --> Legacy --> Text

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

    I love tutorials like this, I come here to learn and it presents an amazing tutorial on the basics and i use the information to learn to make the game i want.
    I created a script that converts the distance to a percentage. My obstacles are differents weights and the game shows the heavier blocks to be darker which is calculated in a script, and i surprised myself by added a balanced jump mechanic.
    I urge everyone to experiment with these tutorials if you aren't already. It really shows that your learning to make a game without someone telling you exactly how to do it and it's an amazing feeling.

  • @AbdulMoiz-nk1ns
    @AbdulMoiz-nk1ns 6 місяців тому +4

    using UnityEngine;
    using TMPro;
    public class Score : MonoBehaviour
    {
    public Transform player;
    public TextMeshProUGUI scoreText;
    void FixedUpdate()
    {
    // Assuming you want to display the Z position of the player as the score
    scoreText.text = player.position.z.ToString("0");
    }
    }

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

    OMG dude you literally solved half of my problems
    THANKS ....

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

    I can't think of a single time in my life when I even noticed a font or cared about it.
    (unless it was super retro pixellated or literally bleeding or something).

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

      When i want to set time i cant do it even if i do it exactly same like the man in the video. I see your comment is not old much so can you please tell me how you did it? When i go to project settings and click on it, my setting looks really diferent. Did you have the same problem?

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

    When he said create a score, I thought he was talking about music.

  • @frostmusicofficial
    @frostmusicofficial 7 років тому +9

    Seriously!! Can you do another episode of Multiplayer FPS!

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

    my game is getting better and better. thanks!

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

    If your text is super blurry, make sure the font size is set to absolutely huge, then scale down the text using the scale tool

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

    Your shadows, text, and everything is very sharp and clear, however, my Unity is rendering so low quality materials, shadows, I really don't know what to do!

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

      same :|

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

      It might be because the scale is too high in the game window. I changed that to 1 and mine is looking lots sharper.

  • @wyatts5159
    @wyatts5159 4 роки тому +13

    When I tried to input the player into the score script under text there was no place to input it

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

      I have the same thing help

    • @NandKumar-ex6mw
      @NandKumar-ex6mw 3 роки тому +1

      You might have used Transform player instead of public Transform player
      In script ,check it again

    • @jorgem.7408
      @jorgem.7408 3 роки тому +1

      This happened to me as well but noticed I accidentally dragged the playerMovement script down on the assets section. So it was telling me it already existed. Removed the dupe and I was able to drag it to score script.

  • @keary3757
    @keary3757 4 роки тому +13

    Who ever needs help just copy this
    using UnityEngine;
    using UnityEngine.UI;
    public class Score : MonoBehaviour {
    public Transform player;
    public Text scoreText;
    // Update is called once per frame
    void Update () {
    scoreText.text = player.position.z.ToString("0");
    }
    }

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

    Great series I learned more in this than a Udemy course. You just make it more understandable, even if they might have more details.
    For anyone who's number keeps the decimals, put in ToString("f0") . It was probably updated since this video, and the float means a decimal, so set the float to zero! ( As far as I understand it).

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

    absolutely love these turorials it teaches me the fundemantals and some code for future use even though i dont really know c#

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

    I downloaded the script because when I tried to type it out, I couldent get the player as a target for the score, and the downloaded script also doesnt work
    its says "A using clause must precede all other elements defined in the namespace except alias declarations"
    and idea whats wrong

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

    i accidentally made everything the other way around and my score is negative. how do i fix it?
    Edit: scoreText.text = (player.position.x*-1).ToString ("0"); instead of
    scoreText.text = player.position.x.ToString ("0"); is the solution if it helps

  • @whiteyoda7326
    @whiteyoda7326 3 роки тому +5

    Text' does not contain a definition for 'Text' and no accessible extension method 'Text' accepting a first argument of type 'Text' could be found (are you missing a using directive or an assembly reference?)

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

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

    • @Andre-cx4ul
      @Andre-cx4ul 3 роки тому

      I got the same message, try writing "text" with minus "t"

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

      @@Andre-cx4ul minus t? Do you mean lower case t? I tried that too.

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

      @@Nsix4 Instead of "public text scoretext" change it to "public UnityEngine.UI.Text scoretext"

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

      @@somemore9784 Thanks for the help, but I ended up figuring out the issue. I had misspelled using UnityEngine.ui

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

    You have to increase the forward force when you increase the fixed update because of something he mentioned in one of the previous videos:
    We are doing force * time.deltatime which means that as you check your frames more often, the speed will become slower(remember that time.deltatime measures the time since the last frame). This means that as you check your frames more often, each frame will increase the force less.
    But note that this relationship is not linear

  • @johna.5293
    @johna.5293 5 років тому +1

    Tip: Turn of gravity and you can float off the edge of the platform and dodge all the obstacles ;)

  • @shttrdcrystal5030
    @shttrdcrystal5030 3 роки тому +5

    "We are gonna need to increase forward force a little bit"
    *doubles it*

  • @woodenfoundation1465
    @woodenfoundation1465 2 роки тому +6

    IF YOU HAVE ANY BUGS vvvvvvvvvvvvvvvvvvvvv
    bug 1. TMPro if your using TMPro for text make sure to import TMPro instead of UnityEngineUI and also do as I do
    using UnityEngine;
    using TMPro;
    public class Score : MonoBehaviour
    {
    public Transform player;
    public TextMeshProUGUI scoreText;
    void update()
    {
    scoreText.SetText (player.position.z.ToString("0"));
    }
    }
    bug 2. if you using TMPro make sure that in unity when dragging the text into the script that its Text Mesh Pro UGUI instead of text
    bug 3. if your getting an error that says it cant find the player position or unknown variable scoreText make sure the player transform is also in the script
    I really hope this help because if I had this it would of saved me 2 hours!

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

      mannnn THANK YOU SO FCKING MUCH!!!!!!!!!!!!!!!!!!!!!

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

      Thank you!

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

      thank you so much !!!

  • @HenryMusgrove
    @HenryMusgrove Рік тому +3

    Stuck at 7:30 the canvas renderer isn't on the newest version

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

    Note about toString(); method:
    ToString(); is one of the many already existing methods of C#.
    ToString(); method is located inside a class specific to this kind of method.
    C# is know for this very aspect.
    A class, for those who don't know about it yet, is basically what you write code inside of since the begining of this project.
    The syntax goes as follow:
    public class ChildClassName : BaseClassName, InterfaceName, InterfaceName, blablabla
    {
    // Code block goes here
    }
    Note that you can only have one base class to support a class
    An interface is a template of another class you wish to implement inside ChildClassName in addition to its base class.
    No need to worry about this yet though.
    Back to the method ToString(); ...
    You can modify pretty much all of you can think of using this kind of method.
    Extremely usefull for math, lists, arrays, dictionaries, .txt files and so on.
    Here is a few exemple for the curious minds:
    * A field is base variable inside a class. The likes of: private int foo = 10;
    ** An Index is the location, from left to right, from 0, of an array. The likes of: string[] ArrayName = { "Value01", "Value02", "Value03" }; // value01 index = 0, value02 index = 1, etc.
    o Math.Sqrt(); // square root
    o Math.Floor(); // round up to lowest. 8.5 = 8
    o Math.Ceiling(); // round up to higher. 8.5 = 9
    o Math.Min(); // min value
    o Math.Max(); // max value
    o String.Join(“InbetweenEach”, value); // Call every value with first parameter in between each.
    o random.Next(minimum, maximum); // Randomize outcome of a number between arg1 and arg2
    o ListName.FieldName.IndexOf(Value); // Return the index of specified value of a list
    o ListName.FieldName.Add(Value); // Add the specified value at the end of the list
    The list goes on.

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

    thank you u restored my faith in humanity

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

    Getting a font shouldn't be too hard...
    Wait, WHY AM I GETTING AN ERROR!?

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

    *TO EVERY ONE WHO'S HAVING TROUBLE WITH THE SCORE*
    After you've written the code, check "text" and go to "Score(script)" then Drag "text" into scoreText, then hopefully it works.

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

      Thank you so much. I thought I did the code wrong but all I had to do was drag text in Score(script)

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

      Score text doesn't show up next to where I put player

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

    I'm trying to make a high score but I don't know how you convert a string to a int or float?
    Please help thx

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

      int test = System.Convert.ToInt32("1000");
      Debug.Log("string of 1000 - 400 =" + (test-400));
      Displays "string of 1000 - 400 = 600" in console. You can also place some string variable in ToInt32(). Beware - if the string cannot be 'cleanly' converted to an Int32, it will throw an exception error. You can use a Try/Catch statement for best practice. There are similar Convert commands for other data types, which you can see once you type 'System.Convert.' into visual studio. You could also place the 'System' namespace in the 'using' statements of your script, then just use the Convert statement in the body.