You are a legend. I have not used unity in 2 years and I'm trying to make a new game for the first time since then and it was driving me nuts trying to set up nav mesh and all of the guides even on unity's official website were not telling me where to find it. Thank you so much!
glad this method still works. It's always annoying when you wanna do something the way you remember and then you get hit with a "X and Y is now deprecated, you must use this now"
Watching old tutorials where the navigation window has the bake option instead of the component of an object. Really didn't want to use obsolete packages to learn 3D, but I couldn't figure it out. Thank you for this video!
Thank you for the information. I was looking for this with the new update and noticed it here. Even though I don't fully understand it yet, I can learn by working on it a little. Thanks again!
I found an old version of the class on the official unity website, but that was very confusing. This video helps me better understand and use the new navigation system, thank you very much.
Thanks. I am also creating videos for the Unity RUclips channel. I recently completed three for using the profiler tools in Unity. I will also be adding more videos here on this channel too.
This is very good and well explained I had no idea on the new separate AI nav mesh & range of options thanks. Its easier than I thought less to do. I find I get by with nav mesh obstacle component with carve to make enemy avoid areas.
Really good and to the point tutorial so the rest of this comment is more so critisizeing Unity. I'm so glad that after years of whining they listened and decided to make the AI navmesh workflow worse while doing literally nothing else so far (with the one exception being that you aren't required to have the component by default).
Literally the first thing he says in the video you need to install the “AI Navigation” To do this, click on… - Window - Package Manager Make sure you select “Packages: Unity Registry” Then type in “AI Navigation” Install it.
Great explanation ! What I'm wondering and what I've noticed is that NavMesh Surface, when baking, weirdly "raises" the height of the walkable surface for some objects in the scene (like a sphere which I added to represent an enemy my player walks towards). What happens is that my player goes to the enemy sphere and then "climbs on top" of it's head
Thanks for watching my content, glad you enjoy it. I am also making videos for the Unity RUclips channel as well and we have recently released an ebook on Unity animation. If you want the links to these I can post them here, just let me know.
@@CreativeMediaTutorials i know Teacher Pete Jepson when i buy course make game horror survival in Unity and i know this link, ebook on Unity Animation i wish Teacher make course about game Moba,look like as game league of leagend
Agents with a priority that matches, eg. 50 will all push each other. Set the priority to about 1 or 2 and no other agent can push them. But if they all are set to 1 or 2 they will once again push each other as they have the same priority.
when i click on window and ai it shows navigation and navigation obsolete but when i click navigation it only shows agent and areas and the obsolete one shows agent areas bake and object pls help
The navmesh agents have an avoidance that should prevent them from walking into each other. By default this is set to 50 for all agents. I sometimes make this a random amount using script, so that some agents can barrel through others, moving them out of the way to add extra interest.
@@CreativeMediaTutorials But this system isn't using a nav mesh agent. Navmesh agents are not supported by DOTS at all. I want a way to achieve dynamic avoidance without using a hybrid approach. Basically, the entities won't overlap each other when traversing through a location.
This is by far the best tutorial I have seen thus far on the recent NavMesh system changes. I am having some different outcomes when it comes to the characters and the baking process. I don't seem to have them cut into the NavMesh like yours do. Also, and I'm assuming this is the same issue as the previous issue, my Modifier doesn't cut out any NavMesh either. Do you know what's going on? (Yes, I am an amateur)
Thanks, glad it helps. Which version of Unity are you using? Check to make sure that all objects are touching the ground. If there are above the ground they won't be cut out of the navmesh. I am planning on making a more complex tutorial for the new AI navigation system so I'll double check these issues when I do that and post here on my channel
@CreativeMediaTutorials Thanks for reaching out so quickly. I am using version 2022.3.5f1. However I know for a fact they are touching it and so is the Modifier but I will try lowering them into the ground a little. I thought maybe one of the options need to be changed in order for the baking to look for the capsule but my "walls" are working as intended. Edit: it is working now, I failed to select the correct agent type on the NavMeshSurface. My mistake!
This is awesome. I guess there is a way to control this programmatically? Can we Bake the scene for each type of agents we have during the loading screen or something like that?
Hi, I'm creating a game on Unity and I'm having problems with AI navigation. I have to do a chase between a bot with a target enemy and a prefab with a target player or the one who plays and I'm trying to use navigation to optimize everything but I can't do it. Can you help me??
thank you Pete - I'm using your course on udemy for environment along James Doyle's FPS in Unity for my game - all the typical tutorials on enemy NPC of course relate to deprecated nav system. Big up - thanks for this what a life saver - please expand to show how "drop" and "jump" come into play - so I guess it's safe to say Rigidbody not good for enemy NPC? It fights the Nav system? I notice your Enemy Controller here is strictly capsule collider thanks!
Hi, Thanks for taking my courses on Udemy. In the package manager for the AI Navigation, you will see the tab called Samples. If you download that it will include some sample scenes, one of which shows you how to setup drops and jumps. I think it might be a good idea to get into that so when I get a bit of time I will create another video for that. Thanks for the suggestion.
I'm a little confused. Apart from a few minor changes, it's almost exactly the same as the old AI Navigation. What exactly has improved so much that they decided to make it a package instead of updating the built-in one?
It's only a minor change, however, now multiple navmeshes can be created in a scene instead of just one, so you can have multiple agents of different size taking different paths
@@PG13park No. If all you want is a simple pathfinding asset then Unity's is more than capable of providing that for you and saving you $100. But if you want more complex pathfinding that has a lot more features and capabilities then you'll still need something like A* Pathfinding or similar alternatives.
You're welcome. I cover random navigation for AI characters in my horror course on Udemy: www.udemy.com/course/make-a-horror-survival-game-in-unity/ It is often on sale for just $9.99
@@Xalkomak347 That's great. The system for randomisation is exactly the same with the newer AI system as it was with the older AI system, so the code in the horror course will work exactly the same, however, now you can give each AI enemy, or zombie a different sized Nav agent if you want them to take different routes to the target points
Anyone that has an issue with their AI maybe like not walking constantly, and just randomly pausing. I was making the AI follow the player using the "SetDestination" method, and that's how I did it before, but now it just stuffs it up, gotta use "Destination" and straight up set it like that.
This is the most basic setup I use in this video, but it can be customized to make it much more realistic, even including some fuzzy logic so the character starts to think for itself. I cover this in my horror survival game course.
Recently I updated to a new Unity version and new AI Navigation package. That was a huge ****** mistake. Everything worked perfectly fine in the old version. But now I have a **** ton more problems than I had out of nowhere. I ******** hate it. What the **** is wrong with them.
Problem: I did your tutorial and it worked but when I wanted to create a game over screen it wont get collision detected when I do it right I need help please!
That's right, this might be something that will be fixed in newer updates. For now you can still use Navigation (obsolete), which is the older version of the AI navmesh to bake a navmesh just for the terrain. This will carve holes for trees. Then when baking a a navmesh for other objects, switch off the terrain and it will bake a navmesh for all other objects. You can now have multiple navmeshes in one scene
Hi, This is a new feature for the updated Unity AI system. I was getting a lot of questions from my learners on Udemy about using the newer AI system in Unity, so I decided to put together this video to help. Unity will be providing a lot of content dedicated to the new AI navigation system. If you check this link: unity.com/how-to You will find all the Unity ebooks and blog guides to help with many of Unity's features. Glad you enjoyed the video.
@@CreativeMediaTutorials Gotcha. You wouldn't happen to know how to make agents path around other agents by any chance would you? I tried adding obstacles to units, but that doesn't work out so well. Either way, appreciate your response and hope you have a good one.
The NavMeshAgent automatically gets agents to avoid each other and move around each other. You can use the avoidance in the NavMeshAgent. It is set to 50 by default. The smaller the number the higher the priority. So an agent with 10 will make others move out of their way, but an agent with a priority of 1 will easily move another with 10 out of their way.
Hi I find if i try to set destination every frame it doesnt work very well. Edit: Okay I figured out the problem I had multiple navmesh surfaces rather then only 1 which seemed to be the problem
Patrol and chase are part of my RPG courser and Horror survival course on Udemy. I go into a lot of detail how to make AAA style games using Unity from beginning to end.
Thank you so much! But I have a question...If I wish the enemy to follow the player only within a certain range, how would I do it? I tried if (Vector3.Distance(enemy.transform.position, player.position)
I would do it in a 2 step system. First store the value of the Vector3 distance in a float variable. Then do an if statement checking if the new distance variable is less than a certain distance, after which, inside that if statement set the destination to the player. Don't forget to also do an else afterwards which either stops the nav agent or sets an alternate destination, otherwise you won't notice a difference
Have you baked a navmesh? It might be that a navmesh has not yet been created. You also can switch on the display of the navmesh using the overlay panel covered from 0.19 in the video. Make sure that the gizmos are switched on as well, that's the globe icon at the top right of the window, next to the little icon of the camera.
Hi, Which course? This covers the new AI navigation system that will be coming into effect in newer versions of Unity. For now you can still use the older obsolete AI navigation system as well, but it's worth learning the new system for the future.
Is the agent standing on the blue navmesh? If they are not making contact with it they won't be able to move. Check the console for any red errors, that will tell you if there are any issues. Make sure the capsule for the enemy is not marked as static, otherwise it won't move
@@CreativeMediaTutorials I checked, everything is ok. No errors occur, but it is still standing still and slowly turning around. But if I put "Agent.destination = Player.position;" in the start method, then the agent will go to the point where the player was at the beginning of the scene. Could this be related to Unity versions?
@@CreativeMediaTutorials I figured out what my problem was. My player was outside the blue navmesh zone. Therefore, the agent could not reach him. Thank you for noticing me
Yes you can use the newer AI navigation system to generate nav mesh surfaces at runtime, as objects move. I will try and put together a video for this at some point.
There were such examples in the videos of a star pathfinding asset. For example, an object is broken into pieces or new objects are poured onto the surface, and agents determine a new route according to the dropped object. If the new ai navigation package can do that, great.@@CreativeMediaTutorials
If you press the apostraphe key on your keyboard it will open the overlays menu. Switch on AI navigation and then on there check the show nav mesh checkbox to see the blue area. Also ensure that gizmos are switched on to see it.
When I click bake there is a navmesh being created but I can't see it like you do even with "Show NavMesh" activated. I have a 3D Plane as a ground object. Does Navmesh require something different? Like a cube as ground?
how to add a cost to the navigation - eg for pedestrians that can cross roads, but will use crossing when available. In the old system I would add a higher cost to the road, and a lower one to the crossing. Cant see how to do it in this system... what am I missing? ta.
Hi, at 2.51 on the timeline, you'll see the agent settings. Just click on the tab for areas and you can set costs for different areas. This can be accessed from Window/AI/Navigation
I've been fighting a lot with the NavMesh areas, i think they *should be easy* but i just cannot find a way to make them work. is there something you know that might help me? I am just trying to make a couple of rocks have a specific area to be walkable for a type of enemy, nothing too special.
Hi, if you check 6.38 in the video. You can add a nav mesh modifier volume to the area of the rocks. Make it Not walkable and choose all the agents you don't want to walk over the rocks. For the agent you do want to walk across the rocks, leave that one unchecked (That character needs a different agent to the rest). Now when you bake for each agent type you will see it will cut out the rocks for every character except the one who can across rocks.
Just came back to Unity - nav mesh is creating walkable nav mesh ontop of my walls, I have tried to use modifier and volume to override it but its still creating it. The agent doesnt have the angle to jump up so its not an issue just now but later on it could pose problems, any thoughts?
You can add another navmesh surface, but this time make the default area not walkable. Then switch off everything except the walls in the hierarchy and bake. It will now ensure the nav mesh on top of walls is not walkable. See 5.10 for multiple nav mesh surfaces
@@CreativeMediaTutorials So as it turns out, I had a legacy NavMeshSurface script, once I completely done away with those and pulled apart my prefabs it worked fine.
I dont have These edges. It's completly baked till the wall begins. How to get those edges? And my agent always gets stuck after choosing some random points to walk to. The agent just dont finish the path. When you look at it's Gizmo you can see that it's still searching. Any ideas?
Are you using the latest version of Unity and the new AI navigation package? If it is the older AI navigation it would require that the wall objects are marked as static in the inspector
@@dertobbe1176 ensure the walls are on the ground, as in they are touching the ground. Also check your nav agent settings, these might be the cause of not creating gaps for the walls. They are usually told to cut out surfaces that have an angle of 90 degrees or greater
@@CreativeMediaTutorials im curious about the navMesh that's baked. The wall shape itself Was cut out of the mesh so It has to be registrated as obstacle. But it's only the exact shape of the wall and I dont get those edges 🤷♂️ I dont know. My agent anyways dont work proberly. The agent always gets stuck 🙃🙃 He wont finish setDestination. He looks nervously when He is close to it😂
@@dertobbe1176 Try clearing all bakes, as there might be two nav mesh bakes causing issues. Ensure the target the nav agent is following is somewhere on the nav mesh itself so the agent can find it
This is just a simple example, so in this case it would just be clicking in the blue section. However, in more complex projects you would most likely have a raycast to detect when you are clicking within bounds allowing you to click there, and not allowing you to click when out of bounds. I cover raycast terrain clicking to move players in my Create an RPG Game course on Udemy.
Hello. I don't know why my previous comment go deleted so I will post it again. I tried your method but it did not work for me. I had to download from the github repo and drag in the Navmesh components and use their methods in order for it to work. My project is in 2D. does that make a difference?
Hi, I've not tried it in a 2D project. Good to know it works from the github. The documentation for the new AI navigation package can be found here: docs.unity3d.com/Packages/com.unity.ai.navigation@2.0/manual/index.html
Hi, Just ensure the enemy objects are touching the ground plane. If they are hovering above it they may not be making contact and so will not move. If the enemy object has a navmesh agent component on it and the script it should then move, unless there are red errors appearing in the console, which could stop the script from properly running.
Hi, Just make sure you are using Unity 2022.3, it won't show up in Unity 2021 or earlier. In the package manager make sure it is in the Unity Registry, at top left of screen (0.16 in the video)
Ensure you select Unity registry from the drop down list at the top left. This displays all Unity packages available to download in alphabetical order.
You are a legend. I have not used unity in 2 years and I'm trying to make a new game for the first time since then and it was driving me nuts trying to set up nav mesh and all of the guides even on unity's official website were not telling me where to find it. Thank you so much!
You're welcome
exactly what was just happening to me was going insane
Thanks for your help!! Super useful because many older tutorials are outdated with AI and Nav Meshes features
You're welcome
glad this method still works. It's always annoying when you wanna do something the way you remember and then you get hit with a "X and Y is now deprecated, you must use this now"
Watching old tutorials where the navigation window has the bake option instead of the component of an object. Really didn't want to use obsolete packages to learn 3D, but I couldn't figure it out. Thank you for this video!
Glad it helped!
Thank you for the information. I was looking for this with the new update and noticed it here. Even though I don't fully understand it yet, I can learn by working on it a little. Thanks again!
Glad I could help!
Thanks for the video! since lasts update, me as a new user only find oldest videos who makes me so confuse. Great Job!
You're welcome, glad it helps
Clean and cut to the point explanation with everything i needed to know. Very easy to understand video. Thanks a lot
Glad you liked it
thank you! showing off these features saved me a lot of time
You're welcome
I spent waaay more time than I'd like to admit trying to figure out how to exclude my player and enemies from the navmesh bake. Thanks. :)
Glad I could help!
I found an old version of the class on the official unity website, but that was very confusing. This video helps me better understand and use the new navigation system, thank you very much.
Glad it helped!
Thanks, very helpful! The new navmeshsurface looks a lot more powerful than the original implementation of navmesh.
Thank you for this tutorial Mr. Jepson. I'm using Unity 2022.3.8f1 at the moment and learning through your project Zombie Tower Defence.
You're welcome and thanks for taking my course
Thank you! You have a very straight forward way to teach things! Love that! I hope you don't stop! Subscribed!
Thanks. I am also creating videos for the Unity RUclips channel. I recently completed three for using the profiler tools in Unity. I will also be adding more videos here on this channel too.
This is very good and well explained I had no idea on the new separate AI nav mesh & range of options thanks. Its easier than I thought less to do. I find I get by with nav mesh obstacle component with carve to make enemy avoid areas.
Glad it helped!
OMG THANK YOU FOR SAYING TO INSTALL IT!! NO OTHER TUTORIAL DID THIS!!! THANK YOU SO MUCH!
You're welcome, glad it was helpful
A brilliant tutorial and well needed thanks !
You're welcome
Thank you, so much useful information in such a short video!
You're welcome
Really good and to the point tutorial so the rest of this comment is more so critisizeing Unity. I'm so glad that after years of whining they listened and decided to make the AI navmesh workflow worse while doing literally nothing else so far (with the one exception being that you aren't required to have the component by default).
Hmm, there is no AI Navigation package in the Unity Registry for me.
Literally the first thing he says in the video you need to install the “AI Navigation”
To do this, click on…
- Window
- Package Manager
Make sure you select “Packages: Unity Registry”
Then type in “AI Navigation”
Install it.
wrong place then
For the life of me I could not figure out how to set up the new Area regions feature since it changed in the new update. Thanks!
You're welcome
Thank you! This helped a lot! Was confused after the update.
You're welcome!
Thank you so much, you are a fast and educational person.
You are welcome! Thanks for watching
Thanks for tutorial on newer version of NavMesh
You're welcome
Thank you so much. I watched a few tutorials on how to use it, but never how to get it.
You're welcome
I'm new to Unity and I am glad I found this video, very helpful and informative, thank you! (You got yourself a new subscriber 😉😉)
Awesome, thank you!
thank you so much this video has saved me from a week of trying to figure this out
Glad it helped!
The new AI navigation system look quite simple and useful! Thank U.
Glad it was helpful!
Awesome! This is exactly what I needed. I'm gonna save this video for whenever I need it again.
You're welcome. Glad the video is useful
Was looking everywhere in the windows to find 'Navigation' and could not find it. I'm used to it being there by default. Thank you.
You're welcome
Thank you for the information!!!. Your tutorial helped me a lot
Glad it helped!
Thank you so much. That was a clear explanation!
You're welcome
Congrats 1k subs! Had the pleasure to be the thousandth. .
Awesome! Thank you!
Thank you very much!
You're welcome!
Great explanation ! What I'm wondering and what I've noticed is that NavMesh Surface, when baking, weirdly "raises" the height of the walkable surface for some objects in the scene (like a sphere which I added to represent an enemy my player walks towards). What happens is that my player goes to the enemy sphere and then "climbs on top" of it's head
This is the step height of the nav mesh agent. Try lowering that and it fixes the navmesh covering items that are low to the ground
Thank you so much. Your explanation is very clear and very helpful!
Thanks, glad you enjoyed the video
Window - Package Manager - in the left up corner select Packages: Unity Registry
this is Teacher Pete Jepson, he is best Teacher !!!!!
his voice very familiar !!!
Thanks for watching my content, glad you enjoy it. I am also making videos for the Unity RUclips channel as well and we have recently released an ebook on Unity animation. If you want the links to these I can post them here, just let me know.
@@CreativeMediaTutorials
i know Teacher Pete Jepson when i buy course make game horror survival in Unity
and i know this link, ebook on Unity Animation
i wish Teacher make course about game Moba,look like as game league of leagend
thanks! I don't know how to make agents not run/push into each other
Agents with a priority that matches, eg. 50 will all push each other. Set the priority to about 1 or 2 and no other agent can push them. But if they all are set to 1 or 2 they will once again push each other as they have the same priority.
Awesome video! Thank you!
You're welcome
thanks for your help!
when i click on window and ai it shows navigation and navigation obsolete but when i click navigation it only shows agent and areas and the obsolete one shows agent areas bake and object pls help
Very nice video man!
Any ideas on how to prevent the agents from clustering together and walking all over each other?
The navmesh agents have an avoidance that should prevent them from walking into each other. By default this is set to 50 for all agents. I sometimes make this a random amount using script, so that some agents can barrel through others, moving them out of the way to add extra interest.
@@CreativeMediaTutorials But this system isn't using a nav mesh agent. Navmesh agents are not supported by DOTS at all. I want a way to achieve dynamic avoidance without using a hybrid approach. Basically, the entities won't overlap each other when traversing through a location.
Thank you dude for this video
You're welcome
Thanks for this update!!
You're welcome
thank you man, this really helped me
Glad it helped
thx for your hard work man! v appreciated
I appreciate that!
This is by far the best tutorial I have seen thus far on the recent NavMesh system changes. I am having some different outcomes when it comes to the characters and the baking process. I don't seem to have them cut into the NavMesh like yours do. Also, and I'm assuming this is the same issue as the previous issue, my Modifier doesn't cut out any NavMesh either. Do you know what's going on? (Yes, I am an amateur)
Thanks, glad it helps. Which version of Unity are you using? Check to make sure that all objects are touching the ground. If there are above the ground they won't be cut out of the navmesh. I am planning on making a more complex tutorial for the new AI navigation system so I'll double check these issues when I do that and post here on my channel
@CreativeMediaTutorials Thanks for reaching out so quickly. I am using version 2022.3.5f1. However I know for a fact they are touching it and so is the Modifier but I will try lowering them into the ground a little. I thought maybe one of the options need to be changed in order for the baking to look for the capsule but my "walls" are working as intended.
Edit: it is working now, I failed to select the correct agent type on the NavMeshSurface. My mistake!
This is awesome. I guess there is a way to control this programmatically? Can we Bake the scene for each type of agents we have during the loading screen or something like that?
Thank you, very helpful video
You are welcome!
V helpful and clear. Thank
Glad it was helpful!
this is a very good tutorial thanks
Glad you like it!
Excellent Teaching
Thanks
Hi, I'm creating a game on Unity and I'm having problems with AI navigation. I have to do a chase between a bot with a target enemy and a prefab with a target player or the one who plays and I'm trying to use navigation to optimize everything but I can't do it. Can you help me??
I cover more advanced AI navigation in my Horror Survival course on Udemy.
Very helpful thanks!
You're welcome
thank you Pete - I'm using your course on udemy for environment along James Doyle's FPS in Unity for my game - all the typical tutorials on enemy NPC of course relate to deprecated nav system.
Big up - thanks for this what a life saver - please expand to show how "drop" and "jump" come into play - so I guess it's safe to say Rigidbody not good for enemy NPC? It fights the Nav system? I notice your Enemy Controller here is strictly capsule collider thanks!
Hi, Thanks for taking my courses on Udemy. In the package manager for the AI Navigation, you will see the tab called Samples. If you download that it will include some sample scenes, one of which shows you how to setup drops and jumps.
I think it might be a good idea to get into that so when I get a bit of time I will create another video for that. Thanks for the suggestion.
I'm a little confused. Apart from a few minor changes, it's almost exactly the same as the old AI Navigation. What exactly has improved so much that they decided to make it a package instead of updating the built-in one?
It's only a minor change, however, now multiple navmeshes can be created in a scene instead of just one, so you can have multiple agents of different size taking different paths
Is it better than A* Pathfinding now?
@@PG13park It's roughly the same as it was before, only now you can have multiple navmeshes in the same scene that target different AI agents
@@PG13park No. If all you want is a simple pathfinding asset then Unity's is more than capable of providing that for you and saving you $100. But if you want more complex pathfinding that has a lot more features and capabilities then you'll still need something like A* Pathfinding or similar alternatives.
c'mon, having to select your "ground" etc and make them Navigation static - was just TOO MUCH
amazing video!! sir a beast
Appreciate it!
i cant see "AI" in the gameobject tab, at the bottom i just see UI.
Ensure you have the AI package installed from the package manager or it won't show up
Thank you for this tutorial. Could you do one for random navigation too?
You're welcome. I cover random navigation for AI characters in my horror course on Udemy:
www.udemy.com/course/make-a-horror-survival-game-in-unity/
It is often on sale for just $9.99
@@CreativeMediaTutorials Pete Jepson, is that you?! I already am enrolled in your horror course.
@@Xalkomak347 That's great. The system for randomisation is exactly the same with the newer AI system as it was with the older AI system, so the code in the horror course will work exactly the same, however, now you can give each AI enemy, or zombie a different sized Nav agent if you want them to take different routes to the target points
Anyone that has an issue with their AI maybe like not walking constantly, and just randomly pausing. I was making the AI follow the player using the "SetDestination" method, and that's how I did it before, but now it just stuffs it up, gotta use "Destination" and straight up set it like that.
This is the most basic setup I use in this video, but it can be customized to make it much more realistic, even including some fuzzy logic so the character starts to think for itself. I cover this in my horror survival game course.
Amazing Thank you !!!
You're welcome
Recently I updated to a new Unity version and new AI Navigation package. That was a huge ****** mistake. Everything worked perfectly fine in the old version. But now I have a **** ton more problems than I had out of nowhere. I ******** hate it. What the **** is wrong with them.
Thanks ! Very helpfull
You're welcome!
Problem: I did your tutorial and it worked but when I wanted to create a game over screen it wont get collision detected when I do it right I need help please!
The NavMesh surface bake does not seems to recognize painted trees as obstacle?
That's right, this might be something that will be fixed in newer updates. For now you can still use Navigation (obsolete), which is the older version of the AI navmesh to bake a navmesh just for the terrain. This will carve holes for trees. Then when baking a a navmesh for other objects, switch off the terrain and it will bake a navmesh for all other objects. You can now have multiple navmeshes in one scene
Your trees needs the component NavMeshObstacle, Carve on, for cutting the surface.
thx, very helpful!!
Glad it helped!
Thanks. very helpful?
thanks a lot . very helpful
You're welcome
You are the guys who guild the RPG Course in Udemy right?
Yes that's correct.
Nice. Tried looking for this in a lot of places, including the Unity docs, but it all seemed outdated. How do you even figure this out?
Hi,
This is a new feature for the updated Unity AI system. I was getting a lot of questions from my learners on Udemy about using the newer AI system in Unity, so I decided to put together this video to help. Unity will be providing a lot of content dedicated to the new AI navigation system. If you check this link: unity.com/how-to You will find all the Unity ebooks and blog guides to help with many of Unity's features. Glad you enjoyed the video.
@@CreativeMediaTutorials Gotcha. You wouldn't happen to know how to make agents path around other agents by any chance would you? I tried adding obstacles to units, but that doesn't work out so well. Either way, appreciate your response and hope you have a good one.
The NavMeshAgent automatically gets agents to avoid each other and move around each other. You can use the avoidance in the NavMeshAgent. It is set to 50 by default. The smaller the number the higher the priority. So an agent with 10 will make others move out of their way, but an agent with a priority of 1 will easily move another with 10 out of their way.
Hi I find if i try to set destination every frame it doesnt work very well.
Edit: Okay I figured out the problem I had multiple navmesh surfaces rather then only 1 which seemed to be the problem
Bro thx soooooooo much your a legend
You're welcome, glad you enjoyed the video
THANK YOU
coudnt find the navmesh anywhere
Thanks for the video
Patrol and chase are part of my RPG courser and Horror survival course on Udemy. I go into a lot of detail how to make AAA style games using Unity from beginning to end.
Hi , in your horror game course in udemy are you using unity new AI Navigation system or old one?
I am using the older Ai Navigation system in the Horror game course, but it is easy to upgrade to the newer AI navigation system
you know if we would want it to follow us only when clicked/touch them, until then the enemy be neutral?
stop the agent in code using .isStopped = true; Then to get moving again .isStopped = false;
Tysm 💗💗💗
You're welcome
Thank you so much! But I have a question...If I wish the enemy to follow the player only within a certain range, how would I do it? I tried if (Vector3.Distance(enemy.transform.position, player.position)
I would do it in a 2 step system. First store the value of the Vector3 distance in a float variable. Then do an if statement checking if the new distance variable is less than a certain distance, after which, inside that if statement set the destination to the player. Don't forget to also do an else afterwards which either stops the nav agent or sets an alternate destination, otherwise you won't notice a difference
Thank you so much!
You're welcome
Hello great tutorial, I can not display the navmesh would you have an idea?
Have you baked a navmesh? It might be that a navmesh has not yet been created. You also can switch on the display of the navmesh using the overlay panel covered from 0.19 in the video. Make sure that the gizmos are switched on as well, that's the globe icon at the top right of the window, next to the little icon of the camera.
Hi, does this video is inteded to cover whats in no. 52 of your Udemy course? thanks.
Hi, Which course? This covers the new AI navigation system that will be coming into effect in newer versions of Unity. For now you can still use the older obsolete AI navigation system as well, but it's worth learning the new system for the future.
can you do a video on 2D, it seems the navmeshmaster handles 2D okay. could use more information on the 2d version
Thanks for the suggestion, I'll consider it for a future video. I haven't used AI navigation in 2D, so it might be worth exploring.
I have a question, why does my agent stand still and slowly turn around? I did everything the same as shown in the video
Is the agent standing on the blue navmesh? If they are not making contact with it they won't be able to move. Check the console for any red errors, that will tell you if there are any issues. Make sure the capsule for the enemy is not marked as static, otherwise it won't move
@@CreativeMediaTutorials I checked, everything is ok. No errors occur, but it is still standing still and slowly turning around. But if I put "Agent.destination = Player.position;" in the start method, then the agent will go to the point where the player was at the beginning of the scene. Could this be related to Unity versions?
@@CreativeMediaTutorials I figured out what my problem was. My player was outside the blue navmesh zone. Therefore, the agent could not reach him. Thank you for noticing me
Thanks. I have a question. This package can rebake navmesh surface in runtime?
Yes you can use the newer AI navigation system to generate nav mesh surfaces at runtime, as objects move. I will try and put together a video for this at some point.
There were such examples in the videos of a star pathfinding asset. For example, an object is broken into pieces or new objects are poured onto the surface, and agents determine a new route according to the dropped object. If the new ai navigation package can do that, great.@@CreativeMediaTutorials
@pena028 I have created a video showing you how to create a navmesh at runtime: ruclips.net/video/bELFjNNOfn0/видео.html
I tried on a plane but the blue surface doesn't show up. Should i use terrain?
If you press the apostraphe key on your keyboard it will open the overlays menu. Switch on AI navigation and then on there check the show nav mesh checkbox to see the blue area. Also ensure that gizmos are switched on to see it.
When I click bake there is a navmesh being created but I can't see it like you do even with "Show NavMesh" activated. I have a 3D Plane as a ground object. Does Navmesh require something different? Like a cube as ground?
nevermind - I had to turn on Gizmos
@@LucidWarlocks thank you
Do I have to download an older version of unity to get this feature? I have the most up to date version.
This is the latest version of AI navigation. Older versions of Unity such as 2021 and before will use the older obsolete version of AI navigation
how to add a cost to the navigation - eg for pedestrians that can cross roads, but will use crossing when available. In the old system I would add a higher cost to the road, and a lower one to the crossing. Cant see how to do it in this system... what am I missing? ta.
Hi, at 2.51 on the timeline, you'll see the agent settings. Just click on the tab for areas and you can set costs for different areas. This can be accessed from Window/AI/Navigation
I've been fighting a lot with the NavMesh areas, i think they *should be easy* but i just cannot find a way to make them work.
is there something you know that might help me? I am just trying to make a couple of rocks have a specific area to be walkable for a type of enemy, nothing too special.
Hi, if you check 6.38 in the video. You can add a nav mesh modifier volume to the area of the rocks. Make it Not walkable and choose all the agents you don't want to walk over the rocks. For the agent you do want to walk across the rocks, leave that one unchecked (That character needs a different agent to the rest). Now when you bake for each agent type you will see it will cut out the rocks for every character except the one who can across rocks.
THANKS!
You're welcome!
I tried doing what did. However, i keep getting errors. Did you ever get errors and if so could u help me.
What errors are you getting?
Just came back to Unity - nav mesh is creating walkable nav mesh ontop of my walls, I have tried to use modifier and volume to override it but its still creating it.
The agent doesnt have the angle to jump up so its not an issue just now but later on it could pose problems, any thoughts?
You can add another navmesh surface, but this time make the default area not walkable. Then switch off everything except the walls in the hierarchy and bake. It will now ensure the nav mesh on top of walls is not walkable. See 5.10 for multiple nav mesh surfaces
@@CreativeMediaTutorials So as it turns out, I had a legacy NavMeshSurface script, once I completely done away with those and pulled apart my prefabs it worked fine.
@@IXxJordan apparently there is a way to "convert" over - but yikes it warns you - "no going back" so maybe backup/clone first
I dont have These edges. It's completly baked till the wall begins. How to get those edges? And my agent always gets stuck after choosing some random points to walk to. The agent just dont finish the path. When you look at it's Gizmo you can see that it's still searching. Any ideas?
Are you using the latest version of Unity and the new AI navigation package? If it is the older AI navigation it would require that the wall objects are marked as static in the inspector
@@CreativeMediaTutorials it's a 2022 lts release and I added Navmesh yesterday. Plus the walls are static anyways
@@dertobbe1176 ensure the walls are on the ground, as in they are touching the ground. Also check your nav agent settings, these might be the cause of not creating gaps for the walls. They are usually told to cut out surfaces that have an angle of 90 degrees or greater
@@CreativeMediaTutorials im curious about the navMesh that's baked. The wall shape itself Was cut out of the mesh so It has to be registrated as obstacle. But it's only the exact shape of the wall and I dont get those edges 🤷♂️ I dont know. My agent anyways dont work proberly. The agent always gets stuck 🙃🙃 He wont finish setDestination. He looks nervously when He is close to it😂
@@dertobbe1176 Try clearing all bakes, as there might be two nav mesh bakes causing issues. Ensure the target the nav agent is following is somewhere on the nav mesh itself so the agent can find it
Hello, how do i prevent my player character from moving out of bounds
This is just a simple example, so in this case it would just be clicking in the blue section. However, in more complex projects you would most likely have a raycast to detect when you are clicking within bounds allowing you to click there, and not allowing you to click when out of bounds. I cover raycast terrain clicking to move players in my Create an RPG Game course on Udemy.
Hello. I don't know why my previous comment go deleted so I will post it again.
I tried your method but it did not work for me. I had to download from the github repo and drag in the Navmesh components and use their methods in order for it to work.
My project is in 2D. does that make a difference?
Hi, I've not tried it in a 2D project. Good to know it works from the github. The documentation for the new AI navigation package can be found here: docs.unity3d.com/Packages/com.unity.ai.navigation@2.0/manual/index.html
Please help I did the tutorial but my enemy is not moving.
Hi,
Just ensure the enemy objects are touching the ground plane. If they are hovering above it they may not be making contact and so will not move. If the enemy object has a navmesh agent component on it and the script it should then move, unless there are red errors appearing in the console, which could stop the script from properly running.
bro plz help me Ai is not show on top of unity window section and when i try to add nav mesh i cant find in addcomponent
Hi, Just make sure you are using Unity 2022.3, it won't show up in Unity 2021 or earlier. In the package manager make sure it is in the Unity Registry, at top left of screen (0.16 in the video)
thanks alot dude i will try this solution@@CreativeMediaTutorials
art
but when i opened the paackage manager, i still cant see the ai navigatiyon, even if i search its name.. What can i do
Ensure you select Unity registry from the drop down list at the top left. This displays all Unity packages available to download in alphabetical order.
Still can't see the Ai Animation ):@@CreativeMediaTutorials
Do you mean the AI Navigation package in the package manager, or the AI character's movement (animation) in the scene?