Unity NavMesh Tutorial - Basics
Вставка
- Опубліковано 21 вер 2024
- Learn how to create AI pathfinding using the Unity NavMesh components!
This video is sponsored by Unity.
● Watch on Unity's website: goo.gl/jUsU8D
● Example project: github.com/Bra...
♥ Support Brackeys on Patreon: / brackeys
····················································································
♥ Donate: brackeys.com/do...
♥ Subscribe: bit.ly/1kMekJV
● Website: brackeys.com/
● Facebook: / brackeys
● Twitter: / brackeystweet
····················································································
► All content by Brackeys is 100% free. We believe that education should be available for everyone. Any support is truly appreciated so we can keep on making the content free of charge.
····················································································
♪ "Dress Code_ Black - oomiee" by Epidemic Sound (www.epidemicsou...)’
♪ "Straight Out The Basement 1 - Axel Ljung" by Epidemic Sound (www.epidemicsou...)’
For those following the tutorial who are new to Unity3D. Adding the box collider to the ground object is an essential step.
The tutorial makes it seem optional during explanation of what "Use geometry --> physics colliders" setting of the navemeshsurface component does (2:19), but it's latter required for the raycast to hit the floor. If you forget this step (like I initially did) you will only be able to move your player by clicking the player during play mode.
man, thank you! It really does look like it's optional
Life Saviour... Thanks
Thanks! You saved my time
thanks so much!
Thanks man!
Man, I miss this guy. Out of all the unity tutorials I went through, this guy had the clearest explanations, was the most entertaining and, in general, his positive, supportive attitude bolstered my confidence with something I thought I would never be able to do. He is the best teacher anyone could ask for and an inspiration.
me too fr
so true.....
He was the like the god of tutorials for Unity R.I.P Brackeys we will miss you
@@Lost_inTime what?! he passed away? when?
he didn't he gave up his youtube career@@bsythdd4754
Im gonna put Brackeys in the credits of all the games i make
me too. I kind of have to. he pretty much made the game with all the tutorials.
He deserves it
Yas
He will strike
Me too
wow
Sponsored by Unity
You’re doing Unity bro!
Filip Mårtensson b
P
Bibb. B
B boll slow owl
Unity should keep sponsoring him.
thank you so much dude. Literally when im trying to make a game, I'm like, "Dang I need a way to make AI that can navigate the world" and bam, a navmesh tutorial pops in my recommended, you're a life saver man!
Your simple scenes always look so beautiful. You should do a tutorial just on the post processing you use for a scene like this.
I know this is old BUT PLEASE DO THIS
I swear u scare me. You always make tutorials when I need to learn something for my game...
Miguel Montero lol
Same here lol
same here :D
Me 2
i was just talking about it..
Legend has it that brackeys will return one day
and yup he is here
Updates: Instead of Baking your NavMesh his way, Unity has now integrated it into to the main toolbar under "Window", AI > Navigation. From there, navigate to the Bake tab, press bake, and youre good!
Nice video as usual. Initially I did not add a box collider to the ground as he did because the NavMesh was using geometry rather than physics colliders to bake. However, it took me a minute to realize this breaks the raycast from the camera to the mouse position because the object needs a collider for the raycast to return true. Just a tip if your NavMeshAgent seems unresponsive to input.
Thanks man, couldn't figure out why it didn't work, now I just feel dumb.
Your videos are incredibly helpful! Been learning Unity for about a month now and wouldn't be close to where I am right now without your content. Thanks man!
chuk ke rakho
Holly molly.. just when i need it..
No wonder your videos are now sponsored by Unity, you're doing a great job at teaching people how to use it well !
remember to install AI navigation from package manager
I think he should really be making official Unity Tutorials I really find them boring and I love the way he explains everything. Crisp Clear with detail and good examples. @Brackeys Thanks Alot!
I have to say, thanks a bunch Brackeys for your effort to put together such informative tutorials! I have learned so much from you, getting a better and better game designer. So once again, a big thanks!
Excellent tutorial on yet another great feature. I really appreciate how much Unity does, I gave building my own engine a go for about 8 months and it is a ton of work, finally caved into Unity and I'm glad. Now I really appreciate all these little things that the engine does.
about yyou building yyour own engine, thats fire. what inspired that?
Brackeys, you're a life saver. Thank you so much for all these tutorials.
Three days struggling with this ...Brackeys always saves my life!
Also, don't forget to add a collider to your terrain, otherwise the Ray won't hit anything.
That's what missed! Thank you for the comment. I skipped that part, because it looked like Brackeys made a collider just to show that it also could be used in NavMesh Baking.
Thank you!
Im so glad I found your channel I was locked in a box not knowing where to move on to next till I watched some of your tutorial/walkthrough videos and now I know where to go and how to actually use unity I couldn’t hang on to most of the other instructors but I understood you perfectly and I thank you so much you’ve inspired me to keep making games and learning different coding languages. Again thank you
Would you ever do a video to save any game? That would be terrific :)
sulindvas for now, Google player prefrences... It's extremely easy to use. If you need help just reply and I will try my best to answer any questions you may have.
I personally found this quite helpfull. This goes over Player Preferences as well as Serializing to Json. It helped me understanding the Pro's & Cons of either option
ua-cam.com/video/-fAqBNeEWjs/v-deo.html
Started using unity 3 days ago and now i understand a lot
I see you want to argue a lot , seems like you had a bad day ,
Yeah ,
Been two years now i can create Games
I love your tutorials! Thank you so much! If you haven't done one before, could you do a tutorial on grid-based movement like in XCOM or Fire Emblem?
I really like that you put alot of work in the scenes you make before you start the video. That's why you are my favorite youtuber that does tutorials! keep up the good work
Cool! Could you make a more advanced tutorial on runtime nav-mesh generation, please? (I see now in the end of the video there are more advanced things. I hope runtime nav-mesh will be included (In repository I see runtime, GREAT! )). You and your team are awesome!
He has a team?
who are they?
@@installwastaken allah w akhbar
@@outviteslb8143 what the heck?
please dont tell me it was your little bro
My Nav Mesh Surface is COMPLETELY different to the one in the video! And i used the link in the description too!
Very nice you get sponsored be unity 😉
You are gone for 2 months and still helping us out
sponsored by unity? aweasome!
if anyone wondering why the player isn't moving just like I did, plz check DID YOU ADD A BOX COLLIDER ON THE GROUND!! Brackeys should point out we should add a box collider on the ground is a must for the nav system to work. just saying.
"Coding your own games is easier than you think." Anyone?
It kinda is.
yea that anoying ad
"You know what?"
I allways mute it.
Nope.
Love your channel. Might need to update this video since NavMeshSurface no longer exists in Unity 2020. Keep up the awesome work!
- Makes his own scene for around 15 minutes -.
Me: "Ok, i can keep going"
Brackeys: "You can use the link on the description to get this example scene"
Me: *c:*
It just fucking happened to me lmao
Unity basically gave away good money, because you explain it well enough for the watcher to get an amazing understanding of unity. Plus, you do tons of unity anyway. Hey, but you deserve the money for the sponsor.
New insult unlocked:
"I'l bake you like a navmesh!"
:-)
Ezequiel Ciamparella n o
You have the best channel for Unity Developers (Specially for beginners like me). Thank you so much!
Why you have to import a NavMeshComponent when you have it already integrated? Is this a new System?
MadAurion Yes this is a pack of work-in-progress updates to the basic navigation system. It's still in development which is why it's not part of the main Unity software.
MadAurion It would be better if he did the tutorial with the naviagtion window to set the walkable area.
Brilliant Tutorial! I can't believe how easy this process is. Thank you. I think I'm going to have to subscribe because I always land up on your tutorials.
question: how do you access the navmeshsurface component? I can't find it anywhere
So they kind of changed where to find it. There is a simple version you kind under: window - AI - Navigation. To find the more advanced version Brackeys is using here, in the Navigation menu, there is an experimental package URL at the bottom of the window.
@@brethogan3832 Thank you for that!
navmeshsurface component doesn't exist anymore
@@brethogan3832 omg thank you
@@brethogan3832 Thanks
I was just wondering when you were goin to upload this last night. How funny! Great job ;)
i dont have navmesh surface
Hi Julia. You have to download the component from github.com/Unity-Technologies/NavMeshComponents and copy it to the Assets folder of your project.
@@donhelfrich6910 thank you so much! i though i had to create one by myself you saved my times!
The video is outdated
@@jiakhan so? Has unity changed 🤔
@@donhelfrich6910
I legit just started working on my enemies today! Good timing. :)
For people who can't see thei Navmesh, turn on Gizmos. in 2019.3 (earlier maybe aswell) it is outomatically turned off
Aww thanks :) I was going nuts!
You just saved me hours of hardship and rage. THANK YOU.
Dude, thank you so much!
Seriously the best Unity tutorials on UA-cam! So easy to follow! Thank you
Any chance to see a way or suggestions as to limiting the pathfinding to strict angles and straight lines, basically so it doesn't move diagonally and only straight?
do some straight narrow path ? some kind of rail layout,
I know we all love Brackeys but just remember that this is a very outdated tutorial. CodeMonkey has done a similar one on his channel and you no longer require packages and nonsense, it's much simpler now.
Nothing shows up when I try to add NavMeshSurface
same
@@sollillevang5871 It's now in the Navigation Tab next to Inspector.
If you are curious about the maths going on behind the scene search for:
A* algorithm
It is the algorithm for movement path finder and AI actions path finder.
There is no Nav Mesh Surface on mine
0:47
It's in the "Example project" link. #1. Download project from GitHub. #2. Navigate to Asset Folder. #3. Copy the NavMeshComponents folder into your Unity project.
Thanks man
Hi sorry to restart the convo but am i supposed to download all the files in the example project? I want to use it for my own project
Ah nevermind, I found another way. Just went to agent types then object then i select things in the hierarchy and set them as walkable/nonwalkable/jump
Few months late but fantastic stuff. Brackeys is the best.
How did you do these childish '2D' graphics for the game? Is there a component that you have to attach or something?
If you want to make a simple map like in the tutorial you should just make a bunch of cubes and size them accordingly. Or you can download ProBuilder from the Asset Store for free, which can help you make simple maps easy
Rocioiu Sebastian Go to camera and select orthographic view.
Rocioiu Sebastian Trust me, I was you at one point.
Slightly rounded edges? You sure he's not baking shadows?
bruh. This channel has the best videos for early beginners! Thanks too much!
How can I have a line which shows the way of the agent?
You seem very underwelmed that your sponsored by FREAKING UNITY!!!
how do you do realtime NavMesh? like if enemies are walking around or if the walls move
OnlineShopping I think it's a beta feature
OnlineShopping, as he said, we will see it in the next video
Oh cool. I didn't hear that part. Good to know. :)
OnlineShopping You can add a NavMeshObstacle component to have objects dynamically change the nav mesh.
You can use unityengine.ai.navmesh.buildnavmesh(). But it gets though to update in realtime, more practical in turns
I feel like this video needs to be redone. I think things are a little different now. I saw a comment here that explains a lot but there are so many questions beyond what they cover.
This seems to be an important subject.
How did you make the walls one object?
He used ended to make the walls and used a cube to make the ground
What do you mean by "ended"? I am stuck with the same problem.
It's so nice when you hear a person that doesn't speak your language not butcher your name :)
Why is the video called "English"??
ikr
@Peter Calabrese weird..
this seemed like so hard , but with Brackeys ..it's easy ! thank you very very much dude you are so good at this !!!
man, the nav mesh surface component is not coming. what should i do
I also
Does anybody have a suggestion on what to do
To use the NavMesh Surface component, navigate to GameObject > AI > NavMesh Surface. This creates an empty GameObject with a NavMesh Surface component attached to it. A Scene can contain multiple NavMesh Surfaces. I got this from the unity scripting api
AI is not showing up. Not under GameObject and not under Add Component.
Go to git hub ,unity technologies and there you will find it
You don't have to put the player in a separate layer to make the navmesh ignore it, you just need to add the navmesh agent component to the player :) good tutorial
Can you please do a city building game tutorial???
your are the best teacher bro, seriously
why is the video called "english"
idk
For those wondering why NavMeshSurface doesn't appear and why it shows a C# icon, its because its an asset
github.com/Unity-Technologies/NavMeshComponents
I downloaded all of them but my nav mesh surface looks so different
nvm i didnt know you needed to add the editors but thanks alot my project would be horribe with out your help
"Orgre" ;-)
5:50 "Parth"
Raycast is not working on my setup the player isn't moving what should i do...?
I swear every time I need to know something for my game, you seem to upload that exact topic every time...
This is great! Simple, fast, from scratch! Ideal tutor!
This is an awesome NavMesh tutorial! 👍🤓🧡
Awesome! A little bit closer to a Point and Click Adventure tutorial
Note: different agents require DIFFERENT nav mesh GAMEOBJECTS, each one with a navmesh map on italso it's base to gather all navmes in a commen script, even better with a script that andles ALL key presses
Ok, this is just amazing and opens up so many possibilities.
sooo nice of unity to sponsor you
AWESOME "Your Explanation for the lesson is Out of this world".
:)
Just wow. Thank You Brackeys for your awesome tutorials.
Congrats on the Unity sponsorship
Sorry, but for NavMesh, did you install it or just add it to your project? how did you add the NavMesh Surface? i only see Agent and NavMesh Obstacle, never a surface... also when I add the "NavMeshComponents" folder to my project, i get a TON of warning messages like: Assets\NavMeshComponents\Scripts\NavMeshSurface.cs(376,26): warning CS0618: 'PrefabUtility.GetPrefabParent(Object)' is obsolete: 'Use GetCorrespondingObjectFromSource.
i really like how you explained everything in detail in this tutorial😁
I love all your tutorials. Request: Audio Tracker Modules
I'm so happy that the comment section is very helpful and informative let's go gamers
Hey! Following this tutorial I had some errors, like "Failed to create agent because it is not close enough to the NavMesh". The problem was my prefab, a robot that I downloaded for free and imported on Unity. I solved the problem setting the "Base offset", "Radius" and "Height" of the Nav Mesh Agent component. I hope that it will help :D
The NavMesh in 11 Minutes - You should be paid by Unity :) - Thank you so much!!!
You're such an amazing tutor, man.
Awesome tutorial! Thanks... Would love to see how to use the navmesh system in one-directional navigation, for instance, how to create a road network where the agent would always favour driving on the right-hand side of the road.
Any recommendation for up to date tutorial? Many features used in this video are no longer avaliables
You can always look at the Unity documentation and make anything regarding the NavMesh components work.
I've been wating for this since I started following you . Thanks !
Thank you so much for your videos. They are awesome and extremely informative.
so sad that you stopped :( wish you good luck
For those having problem with example project, just build your own project and scene, example project seems really buggy.
Very very very thanks!!! I was trying to find a tutorial like this one, it really helped me a lot!
YAAY Sponsorship and I'm only 2 years late!!
Congratulations on the unity sponsorship :D
JUST RELEASED WHEN I NEED IT!
THANKS A LOT BROTHER .......YOU ARE THE BEST ......AND I LOVES YOUR VIDEO.....IM PROUD TO BE YOUR SUBSCRIBER
So you only learn how to download that script and drag it into your screen? But not how to use unitys navmesh without extern scripts?
Sweet, this is what I was hoping for! This will be very useful
Oooh so many ideas for this. Just need to finish the game I am making rn.
Thankyou very much you just saved my life