Let's Make an RPG Game in Unity! – Part 1: Player Movement



♥ VIDEO LIKE GOAL:
• 75 Likes!
▬▬▬▬▬▬▬▬▬

The first episode of this brand new RPG tutorial series is here! 🙂

I hope you guys enjoy this video. If you do, make sure to leave a
LIKE and hit SUBSCRIBE to stay up to tune for new videos!

Leave a comment regarding what you want to see next.

Download the model here:

▬▬▬

🔗Check out these videos too!
🢥Asset Review: Stylized Nature Pack

🢥Would you like Game Jams?

🔗Playlist for this series!
🢥

▬▬▬

♦ Links:
• My Website:
• Twitter:
• YouTube:

▬▬▬

Partnered by Curse, UnionForGamers.
Owner of MESVER & MESVER NETWORK

47 Comments

  1. Thank you for watching! 🙂

    I hope you guys enjoy this brand new series. A lot of people were asking me to
    start making RPG tutorials, so I decided I would!

    If you enjoy the video, make sure to leave a LIKE and hit SUBSCRIBE to make
    sure you won't miss out on any of my new content! 🙂

    BIG LOVE. <3

  2. Hello! In Vienna there is a course "Unity (basics)" for 2250 Euro(!)/85 hours. Is it worth it? I think it's better to watch some youtube tutorials and save some money.

  3. when i write the code that he has, like Plane, Ray, Vector3 or others that should be a turquoise colour, they don't get highlighted.

  4. you should have made your 'Transform pmr;' a 'GameObject pmr;'. Then you would be able to destroy the pmr gameobject and you do not have to bother converting 'playerMovePoint' to a transform. (playerMovePoint.transform)
    Good series so far though!

  5. When I drag the script onto player, it says the script needs to derive from MonoBehavior. Im confused

  6. If only there was a version of Unity for Chrome OS, I have loads of cool ideas for games, I could even try and get an Xbox license. And no, I do NOT suck for owning a Chrome box, sure it can't do much, which is annoying, but it's less hackable than Windows.

  7. Keep getting NullReferenceException: Object reference not set to an instance of an object
    Player.Update () (at Assets/Scripts/Player.cs:23)

  8. Every dream of otakus or neets SAO to be made in real life and im one of it because i know in fantasy world i could be free not like in real world where you are being controlled by society one thing you do wrong they judge you do all they want but if you made an such a good thing they would be just jealous and they will eventually pierce you with their sharp words the wound that cannot be ever be healed how cruel it is 😔

  9. Dude, youre just like 99% of every coder on youtube. You guys go through the whole trouble of making a "tutorial" that you present as being beginner friendly and yet your jumbled coder brain makes you get so caught up in your own thought process and code that you just leave everybody behind wondering what the hell youre talking about and how you came to the logical conclusion about what youre doing. Simply recording yourself coding isnt actually teaching. Teaching is when you slow down and break apart what youre doing into understandable simple parts and then explaining why you chose to do that specific thing. Youre making money off of these videos and you want more subscribers so why build a whole brand and not actual do things correctly? That would be like spending days coding an entire script for your companies deadline and never actually checking for compilling errors and just sending the script off the your team and then being confused when the script didnt work simply because of minor punctuation errors and a lack of patience.

  10. There's not even a need for the PMR script, just expand your if (moving) { Move()} to: else if(!moving) { Destroy(GameObject.FindGameObjectWithTag("MovePoint"))} (Make sure you add the MovePoint tag to your prefab). Honestly, I don't think you should be making tutorials if you're not entirely confident in what you're doing, you will just end up misleading and confusing people who are interested in game development. not cool.

  11. Hey, for everyone having problems following along, I simplified, shortened and commented the player class. I also saw no need for the PMR class. Maybe it helps some of you.

    using System.Collections;

    using System.Collections.Generic;

    using UnityEngine;

    public class Player : MonoBehaviour

    {

    // Variables.

    [SerializeField]

    float moveSpeed = 24f;

    [SerializeField]

    GameObject playerMovePoint = null;

    GameObject instantiatedMovePoint = null;

    bool isMoving = false;

    // Functions.

    void Update()

    {

    // Create a plane and align it with the player. Later we cast rays to check for intersection.
    Plane plane = new Plane(Vector3.up, transform.position);

    // Create a ray from the mouse click position.

    Ray ray = UnityEngine.Camera.main.ScreenPointToRay(Input.mousePosition);

    // Now we check where the mouse click ray intersects with the plane

    // and store the distance needed in `hitDistance`.

    float hitDistance = 0f;

    if (plane.Raycast(ray, out hitDistance))

    {

    // Get the point on the plane that is 'clicked'.

    Vector3 mousePosition = ray.GetPoint(hitDistance);

    // Left click.

    if(Input.GetMouseButtonDown(0))

    {

    // Indicate that the player should start moving.

    isMoving = true;

    // Remove last instantiated move point.

    if (instantiatedMovePoint)

    DestroyImmediate(instantiatedMovePoint);

    // Create and instantiate new move point that is used as a target for the player to move to.

    instantiatedMovePoint = Instantiate(playerMovePoint, mousePosition, Quaternion.identity);

    }

    }

    // Move the player.

    if (isMoving && instantiatedMovePoint)

    Move();

    }

    public void Move()

    {

    // Move player towards the move point.

    transform.position = Vector3.MoveTowards(transform.position, instantiatedMovePoint.transform.position, moveSpeed * Time.deltaTime);

    // Rotate player towards the move point.

    transform.LookAt(instantiatedMovePoint.transform.position);

    }

    void OnTriggerEnter(Collider other)

    {

    if (other.tag == "PlayerMovePoint")

    {

    // Destroy the current move point when the player reaches it.

    Destroy(other.gameObject);

    instantiatedMovePoint = null;
    // Better safe than sorry 😉
    }

    }

    }

  12. Ufff…. its functional, but by coding standarts thats reaaaaaally messy u.u
    please wrap the different code parts into some functions. would be so much easier to read an follow.

  13. Remove last PMP:

    if (pmp != null)
    {
    GameObject temp = pmp.gameObject;
    pmp = null;
    Destroy(temp);
    pmp = Instantiate(…)
    }

    No need for any "bool pmpSpawned", here you just get the pmp gameobject and hold it in a "temp" GameObject. Then you can set pmp to null, and then destroy the temp (old point) and instantiate a new one.

    For moving you can also just use the (pmp) because now there will never be two Player Move Points at the same time.

    if (pmp)
    {
    Move();
    }

    If PMP is not null, you will always want to move.

  14. OMG have you got any clue what you are even doing!? All you do is read the code you are writing! Please! You can do better! This is not a tutorial, it's ramblings 🙁

  15. I have a weird issue with my game, for some reason (even tho i copied everything from the tutorial) whenever i click somewhere on the plane my player moves the exact opposite way indefinitely! What?!?!
    I know that the tutorial is 1 year old and he is using an older version of Unity…

  16. Nice tutorial dude:D, the only thing that I think should have done better is using SerializeField instead of public for your variables, I'm sure you already know why but aside from that great tutorial

  17. My first time Please Suggest what should I do to start with unity I wanted to be game creater I am little bit confused which language should I learn

  18. Why do you need a PMR script and a prefab just to make the player move to the position? I think you can simply create a private variable called as targetPosition. Initially set it to transform.position and on every click, set PMR vector to this targetPosition vector. In your update, you can keep on doing move towards on each update.

Comments are closed.