Making a Simple Game in Unity (Part 1) - Unity C# Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ธ.ค. 2024

ความคิดเห็น •

  • @CameronPenner
    @CameronPenner 9 ปีที่แล้ว +73

    Tutorial starts at 7:18. for those that want to get straight to it!

    • @fungus5137
      @fungus5137 5 ปีที่แล้ว

      Thanks!

    • @HkLearnsAI
      @HkLearnsAI 2 ปีที่แล้ว +1

      Thank you! VERY COOL!

  • @janzimmer8136
    @janzimmer8136 9 ปีที่แล้ว +60

    For those who use Unity 5, the code shown in this video for the "PlayerMovement" won't be compatible with that version. Use this code instead:
    using UnityEngine;
    using System.Collections;
    public class PlayerMovement : MonoBehaviour
    {
    public float moveSpeed;
    private float maxSpeed = 5f;
    private Vector3 input;
    public GameObject other;
    // Use this for initialization
    void Start ()
    {
    }
    // Update is called once per frame
    void Update ()
    {
    Rigidbody rigidbody = other.GetComponent();
    input = new Vector3 (Input.GetAxisRaw ("Horizontal"), 0, Input.GetAxisRaw ("Vertical"));
    if (rigidbody.velocity.magnitude < maxSpeed)
    {
    rigidbody.AddForce(input * moveSpeed);
    }
    }
    }

    • @TheMinecraftoo7
      @TheMinecraftoo7 9 ปีที่แล้ว

      Jan Zimmer No this didn't work

    • @loganmichael7871
      @loganmichael7871 9 ปีที่แล้ว

      Kyle Barnhart I typed this up, it doesn't work the same as the guy in the video though (It doesn't have that slippery feel.)
      using UnityEngine;
      using System.Collections;
      public class Player : MonoBehaviour {
      public float moveSpeed = 10f;
      void Update () {
      if (Input.GetKey (KeyCode.UpArrow)) {
      transform.Translate(Vector3.forward * moveSpeed * Time.deltaTime);
      }
      if (Input.GetKey (KeyCode.DownArrow)) {
      transform.Translate(-Vector3.forward * moveSpeed * Time.deltaTime);
      }
      if (Input.GetKey (KeyCode.LeftArrow)) {
      transform.Translate(Vector3.left * moveSpeed * Time.deltaTime);
      }
      if (Input.GetKey (KeyCode.RightArrow)) {
      transform.Translate(-Vector3.left * moveSpeed * Time.deltaTime);
      }
      }
      }

    • @RyanFaeScotland
      @RyanFaeScotland 9 ปีที่แล้ว +2

      Kyle Barnhart I don't have Unity in front of me but looking at the code I see there is a declaration of a public variable other which is a type GameObject: public GameObject other; The error you are getting is probably an 'UnassignedReferenceException: The variable other of Movement has not been assigned.' which means you need to drag and drop your Player object onto the Movement script's other field in the inspector to complete the reference.
      However, you shouldn't even need to reference 'other' just call Rigidbody rigidbody = GetComponent() and it should work (untested). Let me know how you get on.

    • @TheMinecraftoo7
      @TheMinecraftoo7 9 ปีที่แล้ว

      Logan F That worked, except it doesn't have the floating feel.

    • @loganmichael7871
      @loganmichael7871 9 ปีที่แล้ว

      Kyle Barnhart
      Yeah I know, I'm still working on that :)

  • @GameGrind
    @GameGrind  8 ปีที่แล้ว +76

    Going on 3 years now. Wow! Nice to see people are still finding it useful even with the API changes. Recently started a new series creating a Simple RPG in Unity 5. A bit more complex, with more advanced programming concepts being used, but the end result is going to be pretty cool!
    Check out the introduction:
    th-cam.com/video/Pp6UNmt8l1I/w-d-xo.html

    • @bulbulitobayagbagan9633
      @bulbulitobayagbagan9633 8 ปีที่แล้ว +1

      Your tutorials are nice and cool! your teaching style is great and easy to understand.

    • @nadyaa7357
      @nadyaa7357 8 ปีที่แล้ว

      same my problem if you have fix it plz let me know so i can fix it 2

    • @uhWilliam
      @uhWilliam 7 ปีที่แล้ว

      I love your teaching style :DD

    • @neerajkumar-greedgamesstud1259
      @neerajkumar-greedgamesstud1259 5 ปีที่แล้ว

      Best tutorial for beginners, slow and understandable

    • @iplayskyblock9095
      @iplayskyblock9095 3 ปีที่แล้ว

      Pin this comment

  • @jerryadkins758
    @jerryadkins758 10 ปีที่แล้ว +2

    So far, this is the best Unity tutorial I've seen! I learned a lot, especially about materials. You take the time to explain things. I can type 80 WPM and would always have to keep pausing videos to keep up when typing in the code while watching the instructor paste in code. I was able to watch your video in one window, and type code in Monodevelop in another window without pausing. Well done!!!

  • @buttfutt4655
    @buttfutt4655 8 ปีที่แล้ว +4

    Thank you so much for not having an obnoxious voice. Your videos are very helpful.

  • @dbredred2604
    @dbredred2604 10 ปีที่แล้ว

    Best.Tut.Ever. He actually explains things! With Brackeys and other programming tutorials they just tell you to write stuff down! This is a series you can actually learn from! I highly recommend this to anyone trying to make a game. Keep up the good work AwfulMedia =) !!!

  • @tomdraws1177
    @tomdraws1177 9 ปีที่แล้ว +9

    i have completely finished this episode in unity 5 and here is my coding to anybody who needs it -
    using UnityEngine;
    using System.Collections;
    public class playermovement : MonoBehaviour {
    public float moveSpeed;
    private float maxSpeed = 5f;
    private Vector3 input;
    // Use this for initialization
    void Start () {
    }
    void Update () {
    input = new Vector3 (Input.GetAxisRaw ("Horizontal"), 0, Input.GetAxis ("Vertical"));
    if (GetComponent().velocity.magnitude < maxSpeed)
    {
    GetComponent ().AddForce (input * moveSpeed);
    }

    }
    }

  • @quakergaming4997
    @quakergaming4997 10 ปีที่แล้ว

    I have been trying to find tutorials on unity, and this guy is the best so far!!!! Every one else goes way to fast and they don't explain things. I have learned to much already! So thank you

  • @hundredfive
    @hundredfive 9 ปีที่แล้ว +40

    PLEASE MAKE A VERSION OF THIS TUTORIAL FOR UNITY 5!

  • @washingtonfaulconer1855
    @washingtonfaulconer1855 10 ปีที่แล้ว

    I really like how you taught people how to actually make the player move instead of just saying 'use the character controller'. Very helpful D:

  • @aaronmcguigan2224
    @aaronmcguigan2224 9 ปีที่แล้ว +5

    I encountered so many problems using Unity 5 so I uninstalled it and reinstalled Unity 4 and everything is going smooth so far. You go in to depth a lot and this really helps, I'm pretty sure you've taught me more in this one video than I've learnt towards this subject in the past 2 years that I've been at college. Thanks a lot!

    • @RyanFaeScotland
      @RyanFaeScotland 9 ปีที่แล้ว

      Aaron McGuigan I started with Unity 4 and I can't remember why (it was earlier this year so I think U5 was out) but I'm pretty glad I did. Looks like I dodged a bullet by doing so, a lot of people having problems following tutorials because of the differences.

  • @chriswilloughby48
    @chriswilloughby48 3 ปีที่แล้ว +1

    I have such fond memories of this tutorial, which I did years ago. You definitely taught me so much and I knew nothing.

  • @seanwilloughby7918
    @seanwilloughby7918 9 ปีที่แล้ว +13

    This is the code that worked for me!
    using UnityEngine;
    using System.Collections;
    public class PlayerMovement : MonoBehaviour {
    public float moveSpeed;
    public float maxSpeed;
    private Rigidbody rb;
    void Start () {
    rb = GetComponent ();
    }
    void FixedUpdate () {
    float moveHorizontal = Input.GetAxisRaw ("Horizontal");
    float moveVeritcal = Input.GetAxisRaw ("Vertical");
    Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVeritcal);
    if (rb.velocity.magnitude < maxSpeed) {
    rb.AddForce (movement * moveSpeed);
    }
    }
    }

    • @1097greenday
      @1097greenday 8 ปีที่แล้ว +1

      +Sean Willoughby thanks dude..i was stuck with that rigidbody.Addforce thing... it really helped..

    • @maroela2
      @maroela2 7 ปีที่แล้ว

      Wow thanks, this actually worked!

    • @SuperJac009
      @SuperJac009 6 ปีที่แล้ว

      U wrot veritcal instead of vertical

    • @erikb.k9363
      @erikb.k9363 6 ปีที่แล้ว

      What do i need to press ?
      I am a C# noob...

  • @Zero86Sk
    @Zero86Sk 10 ปีที่แล้ว

    I just started working with unity, i have no programing knowlage what so ever and your vidoes and explenations are so awesome. They really helped me alot.

  • @bobobo1993
    @bobobo1993 9 ปีที่แล้ว +21

    Movement for Unity 5:
    using System.Collections;
    public class PlayerMovement : MonoBehaviour {
    public float moveSpeed;
    private Vector3 input;
    Rigidbody cubeMovement;
    private float maxSpeed = 5f;
    // Use this for initialization
    void Start () {
    cubeMovement = GetComponent();
    }
    // Update is called once per frame
    void Update () {
    input = new Vector3(Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical"));
    if(cubeMovement.velocity.magnitude < maxSpeed)
    {
    cubeMovement.AddForce(input * moveSpeed);
    }
    if(Input.GetKey(KeyCode.A))
    {
    cubeMovement.AddForce(input * moveSpeed);
    }
    if(Input.GetKey(KeyCode.D))
    {
    cubeMovement.AddForce(input * moveSpeed);
    }
    if(Input.GetKey(KeyCode.W))
    {
    cubeMovement.AddForce(input * moveSpeed);
    }
    if(Input.GetKey(KeyCode.S))
    {
    cubeMovement.AddForce(input * moveSpeed);
    }
    }
    }
    Note: cubeMovement = GetComponent(); replaces the Rigidbody.AddForce.
    Great Tut btw!

    • @bobobo1993
      @bobobo1993 9 ปีที่แล้ว +1

      ***** Thought so too but apparently not :C

    • @bradmarcotte6647
      @bradmarcotte6647 9 ปีที่แล้ว

      +marco koopman (Eviltoastey) it said there were inconsistent line endings. some are mac and some are windows

    • @tammyton
      @tammyton 9 ปีที่แล้ว

      +James Robbie It wasn't actually necessary for Marco add that many lines of code to make it work.

    • @Robsfund
      @Robsfund 9 ปีที่แล้ว

      +Marco koopman (Eviltoastey) Code doesnt work - sends cube tumbling around... whats the beef?

    • @BainneK10
      @BainneK10 9 ปีที่แล้ว

      +Marco koopman (Eviltoastey) omg u are a lifesaver, i was following the video to the letter and getting errors i hadn't a clue why, and den your comment's first line set me straight :P though i was wondering why i was missing a menu option he had....anyway i'm also brand new to scripting so i'd have no chance of writing that myself, thank you again :P

  • @_jadonbrown
    @_jadonbrown 10 ปีที่แล้ว

    I'd like to apologize for not giving feedback yet, I am enjoying your tutorials thoroughly. They are such a useful tool to learn Unity on! Thank you so much sir!

  • @ytsjcuser
    @ytsjcuser 10 ปีที่แล้ว +3

    I think I found a workaround for the "z-axis" drift that is occurring during movement. It has to do with the amount of "surface contact" between the floor's box collider and the player's box collider. Because the box collider for the player is the same size as the box, the entire bottom surface of the box (or it's collider) is in constant contact with the floor (or it's collider). This causes the physics engine to generate, what seems to be, random friction points along the two surfaces. In turn this causes the drifting. I've noticed that the drifting isn't always in a constant direction. When the player crosses boundary lines of the floor when the floor is expanded to a larger size, it takes on a new "random" friction direction.
    Ok, so where's the workaround? I started playing with the player collider shape. When I made it a sphere collider (it defaults to the same size and center of the player) the drifting was virtually eliminated. But that posed another problem. When entering the maze the player's vertical edges would enter the maze walls until the sphere collided with the maze walls. This looked funny and it took more penetration into the goal before it registered the trigger (actually this was a nicer effect). In order to correct the interaction with everything else except the floor, I added another collider (a box collider). I set it's height to about half the height of the player box and left it's center alone. This provided the desired collision with the floor and the maze. However, I did have to up the drag on the rigidbody of the player to about 5 since it was only contacting the floor at one tangential point (theoretically).
    I hope this workaround is useful to you.

    • @J0rD4n9001
      @J0rD4n9001 10 ปีที่แล้ว

      Thanks for this.

  • @Shinziga
    @Shinziga 10 ปีที่แล้ว

    The first good and explanatory tutorial found so far. The good thing about your explanation, is you share thoughts, why you did it and why you didnt. Keep up the good work, and Ill watch your tutorials from now on. Rock on!

  • @Wiebrendh
    @Wiebrendh 10 ปีที่แล้ว +8

    That intro is just amazing

  • @Grand_Alchemist
    @Grand_Alchemist 9 ปีที่แล้ว +1

    If your x Axis is affecting the z Axis (and vice versa), try using a sphere or capsule collider instead of a box collider.
    I think the corner of the box collider tends to stick to the floor, which causes the rigidbody to move in the direction the corner is facing.

  • @lleon79
    @lleon79 9 ปีที่แล้ว +4

    Around the 10:00 mark when he uses the directional light, I cannot replicate that in Unity. I have the newest version, has anything changed in how light works in the engine?

    • @SlightlySickish
      @SlightlySickish 9 ปีที่แล้ว +7

      +lleon79 I struggled with this too for a better part of an hour. I think I may have found the answer:
      go to Window > Lighting and under Scene tab make sure Skybox is set to None.
      Suddenly I was able to manipulate the light on the floor. I hope this helps.

    • @SpaceMoses_
      @SpaceMoses_ 9 ปีที่แล้ว +1

      +Chase Lirette Thanks so much for the tips

  • @Patricebrouh
    @Patricebrouh 6 ปีที่แล้ว

    Any beginner must follow these courses first. This course is well explained.

  • @MOOnLight2k
    @MOOnLight2k 8 ปีที่แล้ว +7

    If your cube didn't move after AddForce try to disable its gravity or just increase the moveSpeed.

    • @junaidijaz41
      @junaidijaz41 8 ปีที่แล้ว

      it works for me thnks a lot :)

    • @junaidijaz41
      @junaidijaz41 8 ปีที่แล้ว

      For me i change the position of player box for example little bit high from floor box

  • @FreekHoekstra
    @FreekHoekstra 10 ปีที่แล้ว

    the gravity bug is due to the collision innacurracies of the basic vertex (thin plate) collision.
    basically it gets pushed away from the ground, with some innaccuracies.
    thank you very much for the nice and clear control scheme and clear tutorial, much appreciated :)

  • @PabloEscobar-nj8hy
    @PabloEscobar-nj8hy 8 ปีที่แล้ว +4

    Is c# a good language for developing simple games? I'm currently studying c# in school after learning Java last semester and find it a lot easier! What language do you recommend I expand my knowledge on?

  • @_jadonbrown
    @_jadonbrown 10 ปีที่แล้ว

    Also, it is your Z axis that's supposed to move as Y makes it go up and down. X is horizontal movement and is perfectly assigned. To move "vertically" the depth of the object is changed (Z).

  • @b3jmedia524
    @b3jmedia524 9 ปีที่แล้ว +6

    Error:
    Assets/Scripts/PlayerMovement.cs(18,27): error CS0120: An object reference is required to access non-static member `UnityEngine.Rigidbody.AddForce(UnityEngine.Vector3, UnityEngine.ForceMode)'
    script:
    using UnityEngine;
    using System.Collections;
    public class PlayerMovement : MonoBehaviour {
    public float moveSpeed;
    private Vector3 input;
    // Use this for initialization
    void Start () {
    }
    // Update is called once per frame
    void Update () {
    input = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
    Rigidbody.AddForce (input * moveSpeed);
    }
    }

    • @gonzalozardi8225
      @gonzalozardi8225 9 ปีที่แล้ว

      is rigidbody no Rigidbody

    • @janzimmer8136
      @janzimmer8136 9 ปีที่แล้ว +3

      ***** If you are using Unity 5, you will have to add it manually. Do like so:
      public GameObject other;
      Rigidbody rigidbody = other.getComponent();
      rigidbody.AddForce(1, 1, 1);
      After that, remember to add the "Player" GameObject in the "Player Movement" script on the inspector. Else it won't work

    • @TheDimma4
      @TheDimma4 9 ปีที่แล้ว +1

      Jan Zimmer Well I also use unity 5 and I also have the same problem but which part of the code do I add that code into
      (hopefully that made sense)

    • @janzimmer8136
      @janzimmer8136 9 ปีที่แล้ว +3

      Put it at the beginning of your Update() method. Here's my whole code :) :
      using UnityEngine;
      using System.Collections;
      public class PlayerMovement : MonoBehaviour
      {
      public float moveSpeed;
      private float maxSpeed = 5f;
      private Vector3 input;
      public GameObject other;
      // Use this for initialization
      void Start ()
      {
      }
      // Update is called once per frame
      void Update ()
      {
      Rigidbody rigidbody = other.GetComponent();
      input = new Vector3 (Input.GetAxisRaw ("Horizontal"), 0, Input.GetAxisRaw ("Vertical"));
      if (rigidbody.velocity.magnitude < maxSpeed)
      {
      rigidbody.AddForce(input * moveSpeed);
      }
      }
      }

    • @TheDimma4
      @TheDimma4 9 ปีที่แล้ว

      Jan Zimmer Thank you very much :D

  • @bailey3353
    @bailey3353 9 ปีที่แล้ว +1

    You've just sparked the greatest marble game concept of all time, my friend. This should fuel my interest for Unity and C# now.

    • @pluxfy5071
      @pluxfy5071 3 ปีที่แล้ว

      now that it has been 6 years, how many games have you made?

  • @tellik2672
    @tellik2672 3 ปีที่แล้ว +3

    your welcome
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class Movment : MonoBehaviour
    {
    public float moveSpeed;
    private Vector3 input;
    private float maxSpeed = 5f;
    // Start is called before the first frame update
    void Start()
    {
    }
    void Update()
    {
    input = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
    GetComponent().AddForce(input * moveSpeed);
    }

    }

    • @Kmh-pl9ze
      @Kmh-pl9ze 2 ปีที่แล้ว +1

      Thank you so much

    • @tellik2672
      @tellik2672 2 ปีที่แล้ว

      @@Kmh-pl9ze Your welcome

  • @engiuser
    @engiuser 10 ปีที่แล้ว

    There is no problem with Z if it's still the case... Look at your coordinate system gizmo. Y pointing up, that is what you "locked" in your equation. So your movement is in XZ plane, thats why X and Z coordinates are changing... Hope explained good. Very good tutorial for beginners. Thanks a lot!

  • @michaelwarwavesyn9391
    @michaelwarwavesyn9391 8 ปีที่แล้ว +6

    rigidbody.velocity.magnitude problems??
    Use this: GetComponent().velocity.magnitude

    • @egardoc5076
      @egardoc5076 8 ปีที่แล้ว +3

      Thankyou so much, thats work for me,, thankyou

    • @TheGamerPro57
      @TheGamerPro57 8 ปีที่แล้ว +1

      Thank you! :)

    • @egardoc5076
      @egardoc5076 8 ปีที่แล้ว

      halo maarv, I can't continue at part 6 . if you can do it at part 6. please join the script with me okay. thankyou
      . sorry for bad English

    • @creepcostgaming4910
      @creepcostgaming4910 7 ปีที่แล้ว

      thx

    • @chrisought2627
      @chrisought2627 6 ปีที่แล้ว

      Where do we put it?

  • @kylestankovich2199
    @kylestankovich2199 10 ปีที่แล้ว

    Thank you so much. I got a book on C# and I am not finished yet but it focuses on mainly software which is fine for me as it (so far) has taught me the basics of C# so this was WAY more helpful and easy for me to follow then what it was a while back. Great job with this video bro! I am going to watch all of this series for sure.

  • @Commanderrabbit
    @Commanderrabbit 8 ปีที่แล้ว +3

    everything is fine but I cant move I used GetComponent().AddForce(input * moveSpeed); but still wont move

    • @Caleb-bp8bm
      @Caleb-bp8bm 8 ปีที่แล้ว +1

      same

    • @tournevis1855
      @tournevis1855 8 ปีที่แล้ว

      same

    • @funkygaming8300
      @funkygaming8300 8 ปีที่แล้ว

      try to use unity 5.0.2

    • @IshartMEself
      @IshartMEself 8 ปีที่แล้ว

      Change the Rigid body above to the getcomponent code

    • @xrealx369
      @xrealx369 8 ปีที่แล้ว

      can u explain more Mortycon?

  • @RyanFaeScotland
    @RyanFaeScotland 9 ปีที่แล้ว

    This tutorial is exactly what I was looking for. I'm coming into Unity as a C# programmer and there were a lot of things I wasn't sure about such as how to make references to other components in a GameObject (26:30) so it is good to see you have a similar sort of background.
    Still a lot of difference between the 2 that haven't quite 'clicked' yet but I think your series is going to be very helpful. Thanks for sharing.

    • @RyanFaeScotland
      @RyanFaeScotland 9 ปีที่แล้ว

      RyanFaeScotland Hey look, it's me 2 months ago! Wow I've came on so much from then hehe.

    • @RyanFaeScotland
      @RyanFaeScotland ปีที่แล้ว

      8 years man, wow.

  • @nanuckdogg3338
    @nanuckdogg3338 8 ปีที่แล้ว +2

    i got an error for "getAxis". Severity Code Description Project File Line Suppression State
    Error CS1061 'Vector3' does not contain a definition for 'GetAxis' and no extension method 'GetAxis' accepting a first argument of type 'Vector3' could be found (are you missing a using directive or an assembly reference?) Assembly-CSharp C:\Users\NanuckDogg\Documents\tutorial\Assets\scripts\PlayeMovement.cs 16 Activecould someone help me pls?

    • @ImJedx
      @ImJedx 6 ปีที่แล้ว

      Capital I in input

  • @kingbrodan
    @kingbrodan 7 ปีที่แล้ว

    NOTE: if there is a problem with the rigidbody around 30:07 then try using "GetComponent().AddForce" instead, it worked for me.

  • @TheFunChannel101
    @TheFunChannel101 10 ปีที่แล้ว +3

    I really love the game idea and I was wondering if I could make a full game out of it and distribute it if that is okay? I would like to implement some other features and services in the game.

    • @yotoprules9361
      @yotoprules9361 10 ปีที่แล้ว +1

      Don't see why not, its your own game! You just had some help making it. Do what ever you want with it, if you want say you had help from the maker of this tutorial.

    • @TheFunChannel101
      @TheFunChannel101 10 ปีที่แล้ว

      YOTOPRULES-youtube Okay thanks anways. And yes I will if I make it.

    • @CaptainShorty
      @CaptainShorty 9 ปีที่แล้ว

      JTechGaming
      tell me when released i want it!!!!!

    • @TheFunChannel101
      @TheFunChannel101 9 ปีที่แล้ว

      Captain Shorty sure. I'm gonna add leaderboards, in app purchases, achievements and more!

    • @CaptainShorty
      @CaptainShorty 9 ปีที่แล้ว

      JTechGaming
      tell me when its out

  • @SilvernodeStudios
    @SilvernodeStudios 10 ปีที่แล้ว

    This is probably the best introduction to C# Unity that I've found so far on the net. Thank you!!! Vector3 makes sense now :)

  • @mongoosethe
    @mongoosethe 10 ปีที่แล้ว +8

    This is really good. Thanks a lot for putting in the effort!

  • @elfyn123
    @elfyn123 10 ปีที่แล้ว

    Hey Austin, I'm completely new to this, I know a few people who program, but I've never delved into it myself until recently. I stumbled upon this and I just wanted to say that this is awesome stuff. For me, one of the best ways for me is to just jump right in, and you help with that and teach along the way. Some of the stuff gets a little lost in the abyss at times, but definitely keep up the repetition, it allows the programming diction to stick in people's heads better (my head at the very least). Good job again!

  • @somedude2577
    @somedude2577 8 ปีที่แล้ว +38

    my pc crashed when i told the cube to move

    • @CTMKD
      @CTMKD 6 ปีที่แล้ว +2

      lol

    • @cimpo327
      @cimpo327 6 ปีที่แล้ว

      i thought im the only one

    • @mathew562
      @mathew562 6 ปีที่แล้ว +2

      is your pc good or is it a potato

    • @xxnotmuchxx
      @xxnotmuchxx 6 ปีที่แล้ว +2

      Thats nothing. My computer committed suicide.

  • @PKFacade
    @PKFacade 10 ปีที่แล้ว

    I download your tutorials to watch them later. They have been a great help. I come from a Python/Blender background; and learned some C++ in college, so this clicks so much. It is presented in an understandable and relevant way. It's difficult to get more than a dirty look out of me for a response, but I'd like to thank you for these videos.

  • @victoriagomez3608
    @victoriagomez3608 6 ปีที่แล้ว +3

    void Update () {
    input = new Vector3(Input.GetAxis ("Horizontal"), 0, Input.GetAxisRaw ("Vertical"));
    GetComponent().AddForce(input * maxSpeed);
    {
    GetComponent().AddForce(input * moveSpeed);
    }
    }
    }
    hope this helps!

  • @BrianLewisdev
    @BrianLewisdev 10 ปีที่แล้ว

    I must say, your previous tutorials were very good. This one is a bit fast, I think. I could see how an inexperienced programmer would get lost and have to pause a bunch in these. My suggestion, for those less familiar with Unity... watch a bunch of the videos in succession and THEN go back and follow along. You will have less trouble keeping up, and everything will feel familiar.
    Otherwise, good job Austin. Keep it up. I'm a web developer looking to get into C# and Unity, and these tutorials have been just what the doctor ordered and the pace is just fine for me.. I'd recommend slowing down what you're doing a little bit for the less experienced.

  • @saucyseph3783
    @saucyseph3783 10 ปีที่แล้ว +6

    you make game making look easy :D im only 15 and im going to learn as much as i can from you, im going to make a small game maybe for IOS for my first game or something idk yet, and hopefully people will like it and il start off my game dev career :3

  • @___Noah
    @___Noah 10 ปีที่แล้ว

    The quality of the voice recording really sets this tutorial apart from the rest. Sounds great and is very easy to pay attention to. Thanks!

  • @gaming2bros
    @gaming2bros 10 ปีที่แล้ว +6

    Hi, I'm 13 years old and I'm thinking what kind of subjects should I take later on if I want to become a developer? I was just wandering :)

    • @Mr4Goosey
      @Mr4Goosey 10 ปีที่แล้ว +1

      Hey Kingkizz, honestly, it does not really matter that much. Grades and diplomas don't matter that much in the games industry, except for people who want to work at EA or alike, but if you look on their sites, in generally says (example): "Masterclass game design or equal working experience" as a requirement. The best thing you can do is just start learning and join projects as a programmer or so. Then again, you should know that Game Development is a lot of different things, not just programming ;)
      Hope this helped!
      V_R

    • @gaming2bros
      @gaming2bros 10 ปีที่แล้ว +1

      Ok yeah thanks, I thing starting now at a young age as well will help me with experiance

    • @drovijolt7735
      @drovijolt7735 10 ปีที่แล้ว +1

      Now to sell your identity!

    • @Mr4Goosey
      @Mr4Goosey 10 ปีที่แล้ว +1

      DrOvi Jolt Was that meant for me or for Kingkizz...? And what exactly did you mean by it...?

    • @drovijolt7735
      @drovijolt7735 10 ปีที่แล้ว +2

      I meant it for Kingkizz, and I was joking. At least that's as far as I know.

  • @eroc121
    @eroc121 10 ปีที่แล้ว

    I really enjoyed this series! Austin, you were very clear and concise and I appreciated your thoroughness in regards to explaining every little detailed step along the way to help us beginners.
    One thing I would love to know is how to get an enemy AI to seemingly move randomly through a maze. Not sure if this would be done with a waypoint system where the enemy could randomly choose which nodes to walk to, if it would be some sort of raycasting wall collision detection, or a navmesh function? I would love to learn how to do this without the use of plugins. If anyone knows, I am all ears. Thanks!

  • @MaxTyndall
    @MaxTyndall 8 ปีที่แล้ว +4

    i want that game

  • @AbrarShariar
    @AbrarShariar 9 ปีที่แล้ว +2

    Great tutorial , easy to understand and really helpful for newbies like me who are just getting started with the Unity game engine.Looking forward to more of unity tuts from this channel.
    Keep on uploading these amazing tutorials.

  • @mirrorman4558
    @mirrorman4558 9 ปีที่แล้ว +30

    Part 1 450k views, part 2 70k views. lol.

    • @mirrorman4558
      @mirrorman4558 9 ปีที่แล้ว +21

      Wanted to make Call Of Duty but didn't work out.

    • @badmalik6882
      @badmalik6882 8 ปีที่แล้ว +1

      +StraightUpGaming You can't make COD as it requires almost 200 to 300 people as it very complex and vast

    • @mirrorman4558
      @mirrorman4558 8 ปีที่แล้ว +13

      Malik Bilal Did you read my comment, that's what I said.

    • @aboody006
      @aboody006 8 ปีที่แล้ว +1

      +Malik Bilal Yes you can.. You don't even need a prebuilt engine for it. Programming is not hard at all.

    • @mirrorman4558
      @mirrorman4558 8 ปีที่แล้ว

      ***** You can't make a COD in your lifetime.

  • @stackflow4007
    @stackflow4007 9 ปีที่แล้ว

    Now going to second step. One of the best lessons on youtube.

  • @DavidMauas
    @DavidMauas 6 ปีที่แล้ว +3

    this tutorial seems good - but it is simply filled with irrelevant stuff... minutes of color choosing... come on. make it grayscale and get to the point :/

  • @Ferenc-Racz
    @Ferenc-Racz 4 ปีที่แล้ว

    I just met your videos first time now on youtube. What a great videos! I subscribed right away. Thank you!

  • @lukavignjevic719
    @lukavignjevic719 9 ปีที่แล้ว

    I love these tutorials, because you're one of the few people who actually tell EVERY little detail!
    I am trying to use your tutorials to create a prototype which can be used for Dungeons and Dragons Roll20 as a Combat Simulator type of thingy, where you can actually see the combat and stuff =D

  • @yuan.pingchen3056
    @yuan.pingchen3056 10 ปีที่แล้ว

    I have some suggestions , keep the unity layout default, hierarchy at the left, assets at the left bottom, inspector at the right, scene and game in the middle up, that will be better for beginners

  • @teodorpopescu735
    @teodorpopescu735 8 ปีที่แล้ว +42

    rigidbody.AddForce() is deprecated!
    Use this instead:
    Declare a
    public Rigidbody rbName;
    Then in the Start () method add
    rbName= GetComponent();
    And use it in the Update() method as
    rbName.AddForce(transform.forward * speedModifier);
    -----------------------------------------------------------------------------------------
    ----------------FULL CODE------------------------------------------------------
    ----------------------------------------------------------------------------------------
    public float speedModifier = 10;
    public Rigidbody rb;
    private Vector3 userInput;
    void Start () {
    rb = GetComponent();
    }
    void Update () {
    userInput = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
    rb.AddForce(userInput * speedModifier);
    }

    • @2urirjai
      @2urirjai 8 ปีที่แล้ว

      thanks for update this!

    • @XxXDGamerXxX
      @XxXDGamerXxX 8 ปีที่แล้ว

      thanks

    • @Zyphr--
      @Zyphr-- 8 ปีที่แล้ว

      I know I'm late, but can you explain why you do > ?
      UPDATE: like, I know it's just a variable to make it easier to write later on, but why do you do this: rb.AddForce(...........)

    • @teodorpopescu735
      @teodorpopescu735 8 ปีที่แล้ว

      rb is basically your object, and AddForce() is a method. So you add a force to your object, and as we know, F=m*a, so you give the object an acceleration, which results in velocity.

    • @Zyphr--
      @Zyphr-- 8 ปีที่แล้ว +1

      something else, in the video he writes this:
      if (rigidbody.velocity.magnitude < MaxSpeed) {
      rb.AddForce (UserInput * SpeedModifier);
      }
      the "rigidbody.velocity.magnitude" doesn't work..
      UPDATE: I just found it... you have to use rb (the variable declared earlier) so it becomes: rb.velocity.magnitude

  • @beebstergames7348
    @beebstergames7348 5 ปีที่แล้ว

    This was an excellent beginning tutorial. Ultimately, the entire series was very inspiring and led me to start my own Maze type game. Thanks for the work you did on the video.

    • @CringeMaster64
      @CringeMaster64 5 ปีที่แล้ว

      does it work in 2019

    • @beebstergames7348
      @beebstergames7348 5 ปีที่แล้ว

      @@CringeMaster64 The software I started works on the most recent version of Unity. It just imported no problem.

  • @grazergames
    @grazergames 10 ปีที่แล้ว

    Ur great at these tutorials because normally it would be 10 mins of people rushing to show u stuff

  • @ashtonskeyboards381
    @ashtonskeyboards381 6 ปีที่แล้ว +1

    for the movement of the cube he made it a little more complicated than it has to be for new users you can just use this its bassically the same thing but without the rigid body and vector 3 but using a float for the speed
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class playerMovement : MonoBehaviour {
    public float movespeed;
    void Start ()
    {
    movespeed = 7f;
    }
    void Update ()
    {
    transform.Translate (movespeed*Input.GetAxis("Horizontal")*Time.deltaTime,0f,movespeed*Input.GetAxis("Vertical")*Time.deltaTime);
    }
    }

    • @kvwowv
      @kvwowv 6 ปีที่แล้ว

      thank you for this

    • @kevingorzek
      @kevingorzek 6 ปีที่แล้ว

      This works as of 4JUL18. Thanks.

  • @nobytes2
    @nobytes2 9 ปีที่แล้ว

    Just FYI that little bug when moving X, also moves Y that doesn't happen on the latest Unity 5. Great tutorials by the way!! Love the detailed explanations, and the exploring along the way.

  • @fredykasper1941
    @fredykasper1941 8 ปีที่แล้ว

    I made some simple textures for everything up ahead the floor, player, enemy and the walls and didnt really expect to understand of this tutorial as much as I did. :D Thanks. ^-^

  • @StefanConstantinDumitrache
    @StefanConstantinDumitrache 8 ปีที่แล้ว +1

    I finished this part of the tutorial and I think it's great! I use a sphere instead of a cube, though, it makes some more sense, plus it gives the player the feeling it is unstable and it might roll out of control. I plan to add a texture to it so the rolling is more obvious. I also used different lights, meaning your game will look better in the end, but ok, I guess I'll just go along with my choices, ha ha :D
    Some of the code stuff is deprecated by now, but Unity and Visual Studio seem to know hot to fix things, because for some reason things end up working almost like in the video.
    Here's hoping I'll get to the end of this little project :D
    EDIT: this is how the script looks now...
    using UnityEngine;
    using System.Collections;
    public class PlayerMovement : MonoBehaviour {
    public float moveSpeed;
    private float maxSpeed;
    private Vector3 input;
    // Use this for initialization
    void Start () {
    }
    // Update is called once per frame
    void Update () {
    input = new Vector3(Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical"));
    if(GetComponent().velocity.magnitude < maxSpeed);
    {
    GetComponent().AddForce(input * moveSpeed);
    }
    }
    }

    • @dtayt1
      @dtayt1 ปีที่แล้ว +1

      idk why its so interesting to see old comments and wonder how much their life has changed lmao

    • @alexgrahams222
      @alexgrahams222 10 หลายเดือนก่อน

      @@dtayt1I know right? Reading some of these comments, I wonder how many actually pursued something substantial in game dev or unity. I then wonder what will come of my journey...existential thoughts distracting me from learning, yet again. lol

  • @compoundsound
    @compoundsound 9 ปีที่แล้ว

    I think you got the weird movement on the Z axis because the value of Y on the player is 0.23 not 0.25 so perhaps is causing slight collision with the ground.

  • @BobTheZealot
    @BobTheZealot 10 ปีที่แล้ว +1

    Awful? AwfulMedia is the best media ever!

  • @DimiExperience
    @DimiExperience 8 ปีที่แล้ว

    so, bunch of stuff is a lil different in 5 version, i highly suggest coding in Visual Studio using Resharper, cause some lines are changed, and you need for example instead of animation.Play(); ---------- GetComponent().Play; anyway, in those cases, resharper tells you what to change(in most of cases tho) and also, if your not familiar with c#, watch this guys tuts for it, its great...this problem is also with rigbody, you need to call class GetComponent instead of just going to rigbody property...

  • @trippy4030
    @trippy4030 9 ปีที่แล้ว

    okay, when your using lots of cubes or whatever. if u wanna line them up perfectly hold down v from there u should be able to drag the cube to another and it snaps into place :)

  • @shrey2154
    @shrey2154 10 ปีที่แล้ว

    32:04 my code had a compiler error something to do with the parantheses and the semi colons. Help?

  • @RyanFaeScotland
    @RyanFaeScotland 9 ปีที่แล้ว +1

    Metal Gear Solid called, they want their VR Training levels back!
    Great looking tutorial guys, going to save this and watch after work.

  • @SuperNotausername
    @SuperNotausername 10 ปีที่แล้ว

    You can't slow down because you're telling the game to not update your force IF the body is moving too fast. And it does just that. When you put it in motion, it moves above maxSpeed, hence it doesn't update the force, and with no drag, there's nothing to slow the body down, so it just keeps going at the same speed.
    Hope I helped.

  • @BlenderAddictVideos
    @BlenderAddictVideos 10 ปีที่แล้ว

    I do think I have fixed the cube moving diagonally. I went into the Player's rigid body settings, disabled gravity, then set the drag to 3. But for this to work, you have to have the cube start right on the ground, not above it.

  • @victoriasochivko8848
    @victoriasochivko8848 6 ปีที่แล้ว

    Thanks a lot, as a complete beginner I find your tutorial mesmerizing, and really useful for creating your first game. Subscribed!

  • @edoardoschnell
    @edoardoschnell 10 ปีที่แล้ว

    Wait. At 24:06 isn't instanciating a new vector every frame very inefficient??

  • @nadyaa7357
    @nadyaa7357 8 ปีที่แล้ว

    am having a problem can any one help me am getting an error when am typing this code :"Rigidbody" because it dose not show up for me the next code what i have to "write it "Rigidbody.addForce am talking about minute 3:55

  • @MeroDN
    @MeroDN 9 ปีที่แล้ว +1

    Your voice is *AWESOME!!!*
    Best tutorial ever! Reilly helped me get started with Unity

  • @cyruscookie9507
    @cyruscookie9507 11 ปีที่แล้ว +1

    Do all ur tutorials work with the free version?

  • @Blaze0xA
    @Blaze0xA 9 ปีที่แล้ว

    I learned so many things from this tutorial! Now I am almost finished with my own game called "Dodge the Cubes!"

  • @sully9088
    @sully9088 10 ปีที่แล้ว +1

    Did you ever figure out why the box slides up in the z axis when you go right horizontally?

  • @pascalaverbeck1816
    @pascalaverbeck1816 10 ปีที่แล้ว

    Hey,
    first of all, thanks for that awesome tutorials.
    They helped me alot :).
    And if somebody wants to reduce the "gravity - move - bug" add this under "input = new Vector3...." :
    if (input.x != 0 || input.z != 0) // if player does not press anything
    {
    rigidbody.useGravity = false; // set gravity to false
    }
    else if (rigidbody.velocity.magnitude < 0.05) // if the cube doesn't move "fast" anymore
    {
    rigidbody.useGravity = true; // set gravity to true
    }
    /*
    Operator != means : does not equal to..
    Operator || means : "or"
    example :
    if( x == 0 || x != 1)
    {
    ...
    }
    means :
    if x is equal to 0 or " || " x is not equal " != " to 1
    {
    do : .....
    }
    */
    Edit :
    Here's my Code, remember to change
    public class Move : MonoBehaviour
    to
    public class "Name of your Script without quotes" : MonoBehaviour
    pastebin.com/amcewBNi

  • @ewyband
    @ewyband 10 ปีที่แล้ว

    What computer are you using?

  • @GothicRK
    @GothicRK 10 ปีที่แล้ว

    Nice video! I have a question though...what exactly is the rigidbody.velocity.magnitude thing? I tried looking at the documentation but didn't find any useful/exact info about it.

  • @Darkness0191
    @Darkness0191 7 ปีที่แล้ว

    To change the Ambient:
    Windows -> Lighting -> Settings. Then go to the Environment Lighting in the Environment Tab. Change the source to 'Color'.

  • @tammyton
    @tammyton 9 ปีที่แล้ว

    I thought it's fine that the Z value changes, since X and Z is the left,right,forward,backwards movement of the player. If the Y value was changing wouldn't that be something to worry about?

  • @guineapigjones
    @guineapigjones 10 ปีที่แล้ว +1

    When I try to attach the script to the player, it tells me the script doesn't exist. I did save it after editing, I tried restarting Unity, and I tried creating another script which also Unity is saying doesn't exist. I copied the script shown at 25:17 exactly, and I am not receiving an error message at the bottom of Unity. Any ideas from anyone?

    • @Vorundor
      @Vorundor 9 ปีที่แล้ว +2

      Make sure that in the code the first public class is the same name as the file name.

    • @xristostss7748
      @xristostss7748 9 ปีที่แล้ว

      Vorundor i have the same problem with guineapigjones and i did checked what you sayed... but the error stills comes out :(
      what sould i do ???
      (sorry for my english)

    • @tomdraws1177
      @tomdraws1177 9 ปีที่แล้ว +1

      thankyou Vorundor you fixed my problem and now im abl to continue

  • @berbm
    @berbm 10 ปีที่แล้ว

    The word is slippery and keep up! Im finally learning Unity, thanks to you man. you explain everything in detail and I love it, +1 SUb!

  • @SilverMiraii
    @SilverMiraii 7 ปีที่แล้ว

    rigidbody alone is no longer referring to the component of the gameObject the script is attached to, but there's other easy ways around this.
    Public Rigidbody rb; // will allow you to drag and drop a gameobject into the inspector, and rb will now refer to the rigidbody of
    //that gameobject
    void FixedUpdate{
    rb.AddForce(input);
    }
    Or you can refer to a component of the gameObject the script is attached to as such
    private Rigidbody rb;
    void Start(){
    rb = gameObject.GetComponent();
    }
    void FixedUpdate (){
    rb.AddForce(input);
    }
    Or if you wanna grab a component of another object, even if the script isn't attached to it, then you can say
    private Rigidbody rb;
    void Start(){
    rb = GameObject.FindWithTag("Tag").GetComponent();
    }
    void FixedUpdate(){
    rb.AddForce(input);
    }
    But my favorite method would be with a public variable for code re-usability.

  • @flatbill2
    @flatbill2 9 ปีที่แล้ว

    For all of those using Unity 5 for this tutorial the rigidbody needs to be declared with a reference like this
    rb = GetComponent();
    then you can use
    rb.AddForce(input * moveSpeed);

  • @nickywojcik7882
    @nickywojcik7882 9 ปีที่แล้ว

    what is the unity 5 version of the if statement at 31:22?

  • @thedunnerification
    @thedunnerification 7 ปีที่แล้ว

    @GameGrind I think they fixed the issues with the Z and X axis changing when the other axis only was intended to move. I'm running 5.4 and am not having the issue you experienced.

    • @thedunnerification
      @thedunnerification 7 ปีที่แล้ว

      also, i think i'm going to play around with the 'freeze rotation' off :P

  • @riki6645
    @riki6645 10 ปีที่แล้ว

    Amazing video series, explain everything so well! In-depth but not wasteful with time!

  • @MrPoonmoon
    @MrPoonmoon 8 ปีที่แล้ว

    Great Tut, thank you. The case sensitive input Input threw me at first and I couldnt follow how it could work. Then I realised our own declared 'input' was clawing a stuff from the bigknob Unity 'Input' class.

  • @OneNot
    @OneNot 10 ปีที่แล้ว +2

    The moveSpeed variable doesn't appear in the Player.
    I attached it just fine and the script appears in the Player, but there is no moveSpeed variable?

    • @solnem
      @solnem 10 ปีที่แล้ว

      Make sure to set moveSpeed to public instead of private

  • @kelvinkristianto4674
    @kelvinkristianto4674 10 ปีที่แล้ว +1

    emm need some help,, why the error is like this?
    "Error CS1061: 'UnityEngine.Vector3' does not contain a definition for 'GetAxis' and no extension method 'GetAxis' accepting a first argument of type 'UnityEngine.Vector3' could be found (are you missing a using directive or an assembly reference?) (CS1061) (Assembly-CSharp)"

  • @SwarnimArun
    @SwarnimArun 10 ปีที่แล้ว

    thanks bro i have download unity a week earlier i m a complete noob..........
    But ur vid helped a lot

  • @LioNOHEart
    @LioNOHEart 10 ปีที่แล้ว

    Please explain the code at 32:02 to me
    its hard to understand (i watched the c# series)
    what idont understand it is we have this code ... rigidbody.AddForce (input*movespeed);
    it was called once before we made an if statement and it did what it did (1thing)
    now it was called in an if statement and it did another thing! the same code? why it went quicker? no matter what if statement u have this code shall not change
    the question is
    how did u get to the speed a bit quicker without changing the code (32:23)
    it would be great if you would explain the whole code at 32:02 with more details
    thank you

    • @omerkhan1312
      @omerkhan1312 10 ปีที่แล้ว

      Since he didn't specify an integer for speed, he changed it in his inspected setting of player class he also played around with physics and stuff to get the slide affect... And he also said that if his current speed is less than the movement speed, his current speed will boost up

  • @GamerBoyRobby
    @GamerBoyRobby 9 ปีที่แล้ว

    hey man, i have seen many videos involving movement which were good and helped me make it work but the way you done your tutorial helped me understand the code a bit better and it helped me do a simaler thing in a 2d project so thx man and ill defo be watching the other tutorials

  • @JordanMetroidManiac
    @JordanMetroidManiac 9 ปีที่แล้ว

    If you freeze the rotations on all axes, the Z position won't change when you move on the X and vice versa.

  • @עומרפריאל
    @עומרפריאל 7 ปีที่แล้ว

    Thank you,
    Because of you I have a direction to create a game.
    keep doing what you are doing!!!

  • @chazzconi
    @chazzconi 8 ปีที่แล้ว

    So i used "GetComponent().AddForce(input * moveSpeed); " thanks to +Draknar everything was good with my small cube was moving like a champ until I got to 32:02 . If i put what put in what +AwfulMedia puts in the "if()" statement I get two errors. One states that rigidbody has been depreciated and the other says component doesn't contain a definition for velocity. I know its not a huge deal but I'd rather do it just for the practice and the learning in the new Unity 5. Thank you if you can help!

    • @seiken1917
      @seiken1917 8 ปีที่แล้ว

      Have you set your maxSpeed in the inspector window? By default it would be 0.

  • @archiveradiotokio
    @archiveradiotokio 8 ปีที่แล้ว

    This had gotten good and I know it is back-order but I think it's the first introduction tutorial, yeah I'll subscribe.