IF YOU'RE HAVING PROBLEMS WITH UNITY FREEZING WHILE TRYING TO DO RUNTIME NAV MESH BAKING: Make sure all the objects that are under the layer that you're baking (which by default, is everything) is NOT set to static. If anything that you are trying to bake on runtime is static, Unity will most likely freeze and you'll have to task manager kill it. (At least that was the case for me). This took me like 4 consecutive hours to figure out. I hope this helps someone else who might be having trouble.
I know you're probably not gonna read this but I love you so much dude... I've been scratching my head for the last 3 hours trying to figure this out, I was looking for an answer on google but I couldn't find one, this needs to be Pinned fr.
"Making games is easier than you think, I know that Brackeys is teaching you how to for free, but if you give us a lot of money, we can teach you the exact same stuff he is."
For those who couldn't make the player agent move in example 3, I've got the same problem, it can be solved by assigning the Game Object in start function of the Player Controller script. I do it this way: void Start() { player = gameObject.GetComponent(); cam = Camera.main; } but I believe there're better ways :) Hope it helps with others facing the same problem as mine
Thanks, this was my issue. i assigned the player controller script to the player prefab in example 3. then from your advice added the below code to the start function in the player controller script. would be good if that was included in the tutorial but its free. i hope this helps others as it can be really frustrating. void Start() { agent = gameObject.GetComponent(); cam = Camera.main; }
Bro I love you so much. You only help me with cool tutorials and I actually made 4 games (nothing posted yet) but im so thankful for your help love your content and keep it up!!!
Nice as always, but let me comment here an adjustment I had to make on your original examples which I've downloaded: When the LevelGenerator script instantiates the player, currently it doesn't have a player controller script on it, so I had to include the script on player prefab and also had to include both cam and agent references on code, before it instantiates the player.
Thank you so much for making these free tutorial that are fun to watch, youre always friendly in the comments as well. I've just started learning how to code as being a game designer has been my dream ever since I was little, I just wanted ask, what are some general tips that would make learning languages like c# easier and what are somethings that you wish you know when you were learning?
LD51 and I still come back to these videos , amazing. Maybe i'll switch UE soon , but for small browser games Unity is better. (its also good for bigger games of course but that is what I use it for)
Brackeys, two questins: 1) Will you participate in Universal Unity Challenge? 2) Will you make some summary of that Unity event? Like explanation of new features?
How can I move a labyrinth with gaps? The navmesh obstacle just creates a box or a capsule around the whole object... How can I let it render these gaps?
I have a level generator which uses multiple pre-made blocks to create a whole level. Would I just hold an array of NavMeshSurface's, then cycle through each one calling BuildNavMesh()?
I don't know if Unity has it inbuild now, but you can certainly implement A* yourself. Straight line distance should be good enough for most cases. You'd just have to build the graph yourself, which isn't too hard. A simple solution would be to make your graph a grid and use the Physics system to determine which grid squares are blocked.
I want to learn that because when i select and move a group of units they keep trying to get to the destination and end up moving in a circle there like some kind of ritual
But i hav an idea, make prefabs in the shape formation and when u click on the ground the units will find the nearest prefab to set destination. Probably hav a bool like if unit collider hits the formation point they will find another spot to stand. Similar to waypoints. What do u think?
Make the formation group of gameobjects with about 50 spheres, cubes etc so the units will always have a position in the formation. Number the formation positions from left to right or whatever and refer to them in code
what if instead of a single navmesh "floor", i have several floors(squares) connected and want to generate navmesh in runtime? i'm building a navMesh for each one but the game kinda lags when it happens, is there a way to join the little navmeshsurfaces and build a bigger one, so only building the nav mesh once?
Hey Brackeys. I'm following along on Unity with your project example. It works great and I'm learning a lot very fast. I just noticed now that the Player gameobject doesn't have the Player Controller component script on it by default. On the Example 3 Scene I'm not sure how to attach the Player Controller Script to the Player as the the Player exists only in runtime. When I try to connect the Player Controller script to the Player prefab, I can only attach the Player to the public Agent but cannot attach the Main Camera to Public Cam. Where am i going wrong? Thanks!!
You have to write the script and attach it to the player game object. Then when you compile the script, you can drag the Main Camera into the location on the Editor. This is the script: using UnityEngine; using UnityEngine.AI; public class PlayerController : MonoBehaviour { NavMeshAgent agent; public Camera cam; // Use this for initialization void Start () { agent = GetComponent(); } // Update is called once per frame void Update () { // click left mouse button if (Input.GetMouseButtonDown(0)) { // create a click from the SCREEN SPACE (2d) // into a ray in the WORLD SPACE Ray ray = cam.ScreenPointToRay(Input.mousePosition); RaycastHit hit; // cast the ray and store information of the location the ray has hit if (Physics.Raycast(ray, out hit)) // returns true if actually does hit something { // if the ray its something it is stored in 'hit' (also code ) // use 'hit' to move our dude agent.SetDestination(hit.point); // hit the location the ray hit on naveMesh } } } }
Honestly none of these two replies actually solve your problem I guess. Since I have the same question as you did. Well, my solution is to drag the MainCamera at runtime but that doesn't seem to solve from roots. Thus I tried to find solutions for modifying the script and here is a try: For Camera Variable, use answers.unity.com/questions/49126/getting-a-camera-at-runtime.html as a reference and you can easily assign the MainCamera to the PlayerController Script; For NavMeshAgent, use the code " agent = GetComponent();" I hope this can solve your confussion.
Hey I'm not able to navigate the cylinder block by clicking on the mesh.I used the same steps but still not able to figure out. Any help would be great!!
This is so much better than the original NavMesh functionality. I noticed it only works with terrain. This works with anything that has the designated layer mask. Why isn't it already a part of unity? I've got 2020 and there is no such functionality. The NavMesh component package is great.
If you're having trouble getting the player controller script to work on when the player is dynamically generated. You can add this in. void Start() { if (cam == null) { cam = Camera.main; } if (agent == null) { agent = GetComponent(); } }
No, however making an AI for platformers is very easy and can be done in minutes if you're experienced. If you want a complex Ai look into Line casting and ray casting and calculate in a script where the AI is allowed to go using layermasks. Hope you get you're game working, and that this helps!
@@sketchyconditions heads up if you want do line of sight, use physics.linecast, dont use raycast when doing line of sight, i spent way to much time messing with raycast when linecast did it for me x10 times better and more accuretly.
For performance if you have a really large map. I wonder if it would be possible to re-bake a nav mesh in one area to another. You bake once in an area and once you leave it, it bake for the next area either by a set size or based on the position they're heading. Seeing as it might be taxing to do a large mesh at once so doing a smaller each time you leave one seems more optimal. Then what if you have obstacles you can hang and jump up to, to climb. Or jumping on walls and stay there I wonder how you would do that with a script along with the nav mesh
But when it dynamically generates path with moving objects it takes into consideration objects position at the moment when path is requested, it does not update the path dynamically as the player moves, right? What would happen if you click on point A and WHILE the player is moving to that point, one of the moving objects blocks the path?
The reason behind this is because NavMeshAgent X/Y/Z is changing all the time (by 0.00000x value) when animation is applied and then it starts to become glitchy.
This is an amazing tool and as always an great tutorial on utilizing it, especially with procedural generation, very cool. I am very interested in using this in a slightly different way though and I've searched for resources on the subject and came up empty so far. Is there a way to allow end users to input their own models and utilize run-time Navmesh generation to allow AI agents to navigate it? I'm trying to create a tool for myself and other architecture students to use to place their building model, place some spawn nodes, adjust what kind of AI they would like to spawn, place pre-made objects/furniture with set tags for those ppl to interact with (ppl who work in the building, visitors, ppl coming to eat, kids playing, etc... think SimTower). That way it could be a conceptual tool to make the building model come alive, test procession/circulation, emergency exit procedures, etc... Since this is such a new feature I can't find a damn thing about it.
I really love your tutorials, but I'm having an issue getting through part of this one. I've gone through this tutorial twice now and I keep having the same issue. Whenever I run the game in Example 3 after completing all steps I can't move my Player. When it runs the clone of my player it doesn't have a Cam set or Agent set, but when I try to add them and update the prefab it won't hold the Cam. The NavMeshAgent sticks, but the Camera won't. Whenever I set the main camera to Cam during play mode it works, but obviously that's a temporary fix since it just resets after I stop playing.
Couldn't an obstacle without the carve setting turned on be used for crowd AI. Where you want the AI to be able to move around the navmesh (can't have them carve it) while also steering away from each other.
Great videos, If you had an open world game, with a destructible wall, would you trigger the navmesh to rebake when you destroy the wall allowing access for the AI to travel through? Thanks
this is great! is there a way to make it even more dynamic? so for examle the moving blocks are enemies. choose the less crowded area and also do not move continuously, maybe wait at some point until the area clears?
im having problem where i want the camera to follow the player (diablo like style camera) but the thing is i cant get the camera to not rotate. i tried every Follow camera script i could find but everything ended up in the camera rotating with the character (no i dont have the character set as parent for the camera) thank you for any help
Hi, i build a .apk unsigned and i can install on my device. when i build a .apk signed , i cannot install on my device. And i have no error message of the build. i think i make all ok. what is my problem? where is the error? i need help please
@Brackeys Have you done a tutorial on grappling hooks and making a character vault over a block or something? I'm going to go through all the videos, but for my own purposes I would like to know where to start for this particular feature.
Suppose you have multiple levels, each with have a different navmesh, why is it a sub-object of the player? Sure in code you could swap them out, but logically the navmesh is a component of the map not the player.?
The example scene does not work for me i get error Warnings in my Console all the time After downloading and opening it in unity can someone pls help me?
My project procedurally generates levels with non-uniform tiles (distorted 4-sided/6-sided prisms) which themselves are also procedurally generated. The tiles do not fit into boxes/capsules so I can't automatically carve a navmesh. I know specifically where each vertex is and could build a floor mesh if I knew what to do with it afterward. Is there a way I can still create a useful navmesh? The non-carving obstacle option makes it seem like I might as well forget about it and use some form of A*.
Is this also possible if you use tiles let's say cubes as a ground each tile one cube and the cubes will be created after Player action (prefabs will spawn in )
the player in example 3 doesn't have a movement script, so when i start the game the player can't move. and since the player doesn't exist since its being generated, i cant add it to the script used in earlier videos. Am i supposed to write a script that takes being generated into account? is that a thing?
I figured out a solution. While you cant add the Nav Mesh Agent of the player from the Hierarchy like you normally would, you can look at the prefab in Inspect and drag the Nav Mesh Body down into the script. And for the camera just add the starred lines into the level generator script. public class LevelGenerator : MonoBehaviour { *public Camera camer;* void Start () { *player.GetComponent().cam = camer;* by making a "public" Camera, you can insert the Main Camera into the generator script. The second starred line gets the script for movement and applies the camera to it, satisfying all its needs.
1) Hasn't a new video with navmesh surfaces links published yet? 2) Can you use the last version (2018) for your next videos? Because, for example, a lot of AI scripts were removed in 2018 and now there is a NavMesh window to set up it.
There seems to be no "NavMeshSurface" type anymore. I'm using 2018.2. Can't really use this video for procedural updating I guess as it has become outdated already.
I found the same problem, and figured it out. Here it is: 1) Goto: github.com/Unity-Technologies/NavMeshComponents , download the code; 2) Copy the code into you project folder; 3) Click "GameObject, AI, NavMesh Surface" You got it! Ref: docs.unity3d.com/Manual/NavMesh-BuildingComponents.html
docs.unity3d.com/ScriptReference/AI.NavMeshPath.html A part of NavMeshPath is 'corners', which is an array of Vector3 positions. You can use these in something like a trail or linerenderer to create a line that follows the path to guide the user. Hope this helps!
Not really, considering agents don't calculate another agent in their path until they actually run into it. Better AI would be able to calculate it from a distance "based on sight" if you will.
Cool the first one helped a lot but this one doesn’t because of the type of game I am making but it was still cool. If you can make a video about selecting characters because I have more then one nav mesh agent that would be handy but I don’t mind if you dont 😃
- What happens if the character is moving towards some goal when the navmesh is rebuilt? - Is it possible to place "road objects" making the player faster while on them dynamically?
I haven't tried it yet. So, I was wondering how to make a bunch of enemies that will come for the player but avoid hitting each other. If we use navmesh obstacle component, won't each enemy think of itself as an obstacle and thus stop moving?
Usually enemies would not be navmesh obstacles, they would be navmesh agents, just like the player character. Instead of them going where you click, their SetDestination target could be the player's current transform.position.
@@sharif47 As long as they have colliders, they'll avoid eachother. There was another video on the subject called "Crowd Behaviours on a Dynamic Navmesh in Unity" that shows it in action.
Sebastian Lague has a great tutorial series on making a complex Pathfinding system using A*. I believe it even features multithreading with multiple agents.
Correct, if the obstacles / walls move and change, the flying enemies should not get stuck. Also if there is no ground, this can be a problem because usually a ground is needed to calculate the way to move. But maybe Brackeys have some good work arounds for that.
What I'm saying is, you don't need to take into account the path finding system at all if there are no obstacles in the air. You're just moving a transform from one world position to another, with nothing to stop you.
why i get this error?? Source mesh Combined Mesh (root: scene) does not allow read access. This will work in playmode in the editor but not in player UnityEngine.AI.NavMeshSurface:BuildNavMesh()
When I was experimenting with a navmesh, I had a weird occurrence where the agents all gathered into one point as if the goal/target was there. (Maybe I should name it target instead of goal in the script) Anyone I know why this happened? I had a goal where they gather up and removed it, now there are no goals or targets in the scene and they still gather up like that.
Brackeys can you please do a course of 3d car racing game? There are some tutorials on RUclips about it but either they don't provide valuable information or they are not in high quality. Please?
These NavMesh tutorials are reallly cool! 🤓 We miss you Brackeys ❤️
Same
It's sad that this channel is no more 😢❤️
wow its already been 2 years?
IF YOU'RE HAVING PROBLEMS WITH UNITY FREEZING WHILE TRYING TO DO RUNTIME NAV MESH BAKING:
Make sure all the objects that are under the layer that you're baking (which by default, is everything) is NOT set to static. If anything that you are trying to bake on runtime is static, Unity will most likely freeze and you'll have to task manager kill it. (At least that was the case for me).
This took me like 4 consecutive hours to figure out. I hope this helps someone else who might be having trouble.
This is going to sound strange but I love you. I have been trying to figure out this for the last day this was my issue.
I know you're probably not gonna read this but I love you so much dude... I've been scratching my head for the last 3 hours trying to figure this out, I was looking for an answer on google but I couldn't find one, this needs to be Pinned fr.
Legendary part is that the content in these channel will be enough to feed the community for at least 5 more years :D
Its nearly 4 years past this video but i am still being led to brackeys videos for my problems. as always WE MISS YOU BRACKEYS
He's back!
So glad this is a series slowly getting to more in depth topics about the navmash. Keep up the great work.
Sponsored by Unity, talking about dreams coming true. Cheers bro! Much love from Croatia (=
Thank you for these tutorials. Using only the first 2 tutorials I was able to get pathfinding working in my procedurally built game. THANK YOU
"Making games is easier than you think, I know that Brackeys is teaching you how to for free, but if you give us a lot of money, we can teach you the exact same stuff he is."
What?
Can I hit "Like" more than once? Awsome tutorials, keep the good work!
For those who couldn't make the player agent move in example 3, I've got the same problem, it can be solved by assigning the Game Object in start function of the Player Controller script. I do it this way:
void Start()
{
player = gameObject.GetComponent();
cam = Camera.main;
}
but I believe there're better ways :)
Hope it helps with others facing the same problem as mine
Thanks, this was my issue.
i assigned the player controller script to the player prefab in example 3. then from your advice added the below code to the start function in the player controller script. would be good if that was included in the tutorial but its free. i hope this helps others as it can be really frustrating.
void Start()
{
agent = gameObject.GetComponent();
cam = Camera.main;
}
Always good to watch one of your videos before going to sleep ! Keep up the good work 😉
You are the man! I still don't understand half of what you said tbh lol, but i'm getting there thanks to these vids.
Bro I love you so much. You only help me with cool tutorials and I actually made 4 games (nothing posted yet) but im so thankful for your help love your content and keep it up!!!
You just saved my college project!
Great video! Amazing series! This is one of the best game dev channel! Please make more math for video games vídeos.
Nice as always, but let me comment here an adjustment I had to make on your original examples which I've downloaded: When the LevelGenerator script instantiates the player, currently it doesn't have a player controller script on it, so I had to include the script on player prefab and also had to include both cam and agent references on code, before it instantiates the player.
Thank you so much for making these free tutorial that are fun to watch, youre always friendly in the comments as well. I've just started learning how to code as being a game designer has been my dream ever since I was little, I just wanted ask, what are some general tips that would make learning languages like c# easier and what are somethings that you wish you know when you were learning?
LD51 and I still come back to these videos , amazing. Maybe i'll switch UE soon , but for small browser games Unity is better. (its also good for bigger games of course but that is what I use it for)
WOW! I am making a game and i'm stuck on Dynamic Navmesh since yesterday.... You post a video about it... ARE YOU A WIZARD? HARRY?!?!!
How do you make it dynamic but walkable not an obstacle???
Very useful, I was having trouble with randomly generated levels. I was doing it almost correctly. Thanks!
Brackeys, two questins:
1) Will you participate in Universal Unity Challenge?
2) Will you make some summary of that Unity event? Like explanation of new features?
This is exactly the information I was looking for!
How can I move a labyrinth with gaps? The navmesh obstacle just creates a box or a capsule around the whole object... How can I let it render these gaps?
this tutorial is awesome! thank you very much for helping me in my time of need!
Brakeys, you're the best!
Unity pathfinding has become mega powerful since 2014!
Could this work in a 2D game without other 3rd party libraries?
I love this channel! Thanks for all the knowledge
I have a level generator which uses multiple pre-made blocks to create a whole level.
Would I just hold an array of NavMeshSurface's, then cycle through each one calling BuildNavMesh()?
Can u do sphereical pathfinding???
And good job tbh.
I don't know if Unity has it inbuild now, but you can certainly implement A* yourself. Straight line distance should be good enough for most cases. You'd just have to build the graph yourself, which isn't too hard. A simple solution would be to make your graph a grid and use the Physics system to determine which grid squares are blocked.
Why Can I not add the camera to the player in example 3 unless the game is already playing?
Thanks for the awesome tutorial, I'm waiting for more
Great tutorial dude !
Maybe you can add some enemies too, and they patrol the area and react when they "see" the player
Could you do unit formations on a navmesh (like rts) while we're on the subject?
I want to learn that because when i select and move a group of units they keep trying to get to the destination and end up moving in a circle there like some kind of ritual
But i hav an idea, make prefabs in the shape formation and when u click on the ground the units will find the nearest prefab to set destination. Probably hav a bool like if unit collider hits the formation point they will find another spot to stand. Similar to waypoints. What do u think?
Make the formation group of gameobjects with about 50 spheres, cubes etc so the units will always have a position in the formation. Number the formation positions from left to right or whatever and refer to them in code
what if instead of a single navmesh "floor", i have several floors(squares) connected and want to generate navmesh in runtime? i'm building a navMesh for each one but the game kinda lags when it happens, is there a way to join the little navmeshsurfaces and build a bigger one, so only building the nav mesh once?
watch the next video in the mini-series
@@juanponcedeleon8617 too late now, but thanks ^^ I think I solved it at the time tho
MyChips yeah I guessed so but I did it for those who just watched it ( :
These videos are great, thanks!
Hi.
How can I do the same but between two AIs.
those components conflict when being together?
Hey Brackeys. I'm following along on Unity with your project example. It works great and I'm learning a lot very fast. I just noticed now that the Player gameobject doesn't have the Player Controller component script on it by default.
On the Example 3 Scene I'm not sure how to attach the Player Controller Script to the Player as the the Player exists only in runtime. When I try to connect the Player Controller script to the Player prefab, I can only attach the Player to the public Agent but cannot attach the Main Camera to Public Cam. Where am i going wrong?
Thanks!!
You have to write the script and attach it to the player game object. Then when you compile the script, you can drag the Main Camera into the location on the Editor.
This is the script:
using UnityEngine;
using UnityEngine.AI;
public class PlayerController : MonoBehaviour {
NavMeshAgent agent;
public Camera cam;
// Use this for initialization
void Start () {
agent = GetComponent();
}
// Update is called once per frame
void Update () {
// click left mouse button
if (Input.GetMouseButtonDown(0))
{
// create a click from the SCREEN SPACE (2d)
// into a ray in the WORLD SPACE
Ray ray = cam.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
// cast the ray and store information of the location the ray has hit
if (Physics.Raycast(ray, out hit)) // returns true if actually does hit something
{
// if the ray its something it is stored in 'hit' (also code )
// use 'hit' to move our dude
agent.SetDestination(hit.point); // hit the location the ray hit on naveMesh
}
}
}
}
just try tagging your MainCamera Gameobejct,in the heirarchy, to prebuilt tags "MainCamera" . Works?
Honestly none of these two replies actually solve your problem I guess. Since I have the same question as you did. Well, my solution is to drag the MainCamera at runtime but that doesn't seem to solve from roots. Thus I tried to find solutions for modifying the script and here is a try: For Camera Variable, use answers.unity.com/questions/49126/getting-a-camera-at-runtime.html as a reference and you can easily assign the MainCamera to the PlayerController Script; For NavMeshAgent, use the code " agent = GetComponent();" I hope this can solve your confussion.
Hey
I'm not able to navigate the cylinder block by clicking on the mesh.I used the same steps but still not able to figure out.
Any help would be great!!
This is so much better than the original NavMesh functionality. I noticed it only works with terrain. This works with anything that has the designated layer mask. Why isn't it already a part of unity? I've got 2020 and there is no such functionality. The NavMesh component package is great.
@7:28 This seems outdated. Anyone know how to do this with the current Unity builds?
"using Unity.AI.Navigation;"
If you're having trouble getting the player controller script to work on when the player is dynamically generated. You can add this in.
void Start()
{
if (cam == null)
{
cam = Camera.main;
}
if (agent == null)
{
agent = GetComponent();
}
}
Thanks, I spent a good 15 mins trying to fix this issue, glad you posted this!
Thanksss!!!
Thanks! works!
thank you ;-;
Is it possible to convert this for 2D platformer?
nav mesh only works on 3d :/
No, however making an AI for platformers is very easy and can be done in minutes if you're experienced. If you want a complex Ai look into Line casting and ray casting and calculate in a script where the AI is allowed to go using layermasks. Hope you get you're game working, and that this helps!
@@sketchyconditions heads up if you want do line of sight, use physics.linecast, dont use raycast when doing line of sight, i spent way to much time messing with raycast when linecast did it for me x10 times better and more accuretly.
perfect tutorial as usual :)
For performance if you have a really large map. I wonder if it would be possible to re-bake a nav mesh in one area to another.
You bake once in an area and once you leave it, it bake for the next area either by a set size or based on the position they're heading. Seeing as it might be taxing to do a large mesh at once so doing a smaller each time you leave one seems more optimal.
Then what if you have obstacles you can hang and jump up to, to climb. Or jumping on walls and stay there I wonder how you would do that with a script along with the nav mesh
I know it's 5 years later. But you could just have multiple NavMesh planes right?
For an RTS, would obstacle avoidance be good enough, since regenerating for that many moving objects would be performance heavy?
I am curious about this as well. But I think you kinda answered it already
But when it dynamically generates path with moving objects it takes into consideration objects position at the moment when path is requested, it does not update the path dynamically as the player moves, right? What would happen if you click on point A and WHILE the player is moving to that point, one of the moving objects blocks the path?
Awesome brackeys I love your videos
I would like to see how you work with HeighMesh thats not just a plane but for instance "low poly island" which has height (movement on top of that)
The reason behind this is because NavMeshAgent X/Y/Z is changing all the time (by 0.00000x value) when animation is applied and then it starts to become glitchy.
So how to make sure the maze you generate doesn't surround the player(blocking all the path)?
Another great tutorial!!! Can you please explain a procedural level generation a bit in next video ...Thank you
Is it intended that you can only see the navmesh in the scene editor when the camera is in isometric view?
This is an amazing tool and as always an great tutorial on utilizing it, especially with procedural generation, very cool.
I am very interested in using this in a slightly different way though and I've searched for resources on the subject and came up empty so far. Is there a way to allow end users to input their own models and utilize run-time Navmesh generation to allow AI agents to navigate it?
I'm trying to create a tool for myself and other architecture students to use to place their building model, place some spawn nodes, adjust what kind of AI they would like to spawn, place pre-made objects/furniture with set tags for those ppl to interact with (ppl who work in the building, visitors, ppl coming to eat, kids playing, etc... think SimTower). That way it could be a conceptual tool to make the building model come alive, test procession/circulation, emergency exit procedures, etc... Since this is such a new feature I can't find a damn thing about it.
Sponsered by Unity! Wow, congratulations
I have a navmesh in the scene with it's normal inspector window, but I don't seem to be able to locate it in the hierarchy like Brackeys does.
I really love your tutorials, but I'm having an issue getting through part of this one.
I've gone through this tutorial twice now and I keep having the same issue. Whenever I run the game in Example 3 after completing all steps I can't move my Player. When it runs the clone of my player it doesn't have a Cam set or Agent set, but when I try to add them and update the prefab it won't hold the Cam. The NavMeshAgent sticks, but the Camera won't. Whenever I set the main camera to Cam during play mode it works, but obviously that's a temporary fix since it just resets after I stop playing.
Same issue
Sponsored By Unity… 👌🏼well done
Couldn't an obstacle without the carve setting turned on be used for crowd AI. Where you want the AI to be able to move around the navmesh (can't have them carve it) while also steering away from each other.
Great videos, If you had an open world game, with a destructible wall, would you trigger the navmesh to rebake when you destroy the wall allowing access for the AI to travel through? Thanks
this is great! is there a way to make it even more dynamic? so for examle the moving blocks are enemies. choose the less crowded area and also do not move continuously, maybe wait at some point until the area clears?
So is carve more memory intensive I assume? Since you are remaking the navmesh each time.
Is there a to add a speed modifier to an area on the nav mesh? Like this area is mud so 50% speed here.
im having problem where i want the camera to follow the player (diablo like style camera) but the thing is i cant get the camera to not rotate. i tried every Follow camera script i could find but everything ended up in the camera rotating with the character (no i dont have the character set as parent for the camera) thank you for any help
I recommend you to look into using a cinemachine camera.
Hi,
i build a .apk unsigned and i can install on my device.
when i build a .apk signed , i cannot install on my device.
And i have no error message of the build.
i think i make all ok.
what is my problem? where is the error?
i need help please
The example project on github only has the scenes, why does it lack the animations and the scripts?
From what i saw, its only missing the PlayerController script, which is so that you follow along to learn how to write the script.
@Brackeys Have you done a tutorial on grappling hooks and making a character vault over a block or something? I'm going to go through all the videos, but for my own purposes I would like to know where to start for this particular feature.
What's the Difference between the included Nav Mesh Stuff and the scripts you are using?
Hey can we navigate a player on click but it can only move 90 degrees only with this?👍
Suppose you have multiple levels, each with have a different navmesh, why is it a sub-object of the player? Sure in code you could swap them out, but logically the navmesh is a component of the map not the player.?
The example scene does not work for me i get error Warnings in my Console all the time After downloading and opening it in unity can someone pls help me?
what about on big levels? will buildnavmesh not lag?
My project procedurally generates levels with non-uniform tiles (distorted 4-sided/6-sided prisms) which themselves are also procedurally generated. The tiles do not fit into boxes/capsules so I can't automatically carve a navmesh. I know specifically where each vertex is and could build a floor mesh if I knew what to do with it afterward. Is there a way I can still create a useful navmesh? The non-carving obstacle option makes it seem like I might as well forget about it and use some form of A*.
That's what i currently need ! Thx ! ;)
Is this also possible if you use tiles let's say cubes as a ground each tile one cube and the cubes will be created after Player action (prefabs will spawn in )
Hello , Please What is the position of the camera to get an isometric view like you in the video ! Thank You .
just look at the camera in his video and copy the transform from it
select isomeric
Thank You very much ! I downloaded the example project and I copied the transform
Can you make tutorial a maze which can automatically changed gate open close system
the player in example 3 doesn't have a movement script, so when i start the game the player can't move. and since the player doesn't exist since its being generated, i cant add it to the script used in earlier videos. Am i supposed to write a script that takes being generated into account? is that a thing?
I figured out a solution. While you cant add the Nav Mesh Agent of the player from the Hierarchy like you normally would, you can look at the prefab in Inspect and drag the Nav Mesh Body down into the script. And for the camera just add the starred lines into the level generator script.
public class LevelGenerator : MonoBehaviour {
*public Camera camer;*
void Start () {
*player.GetComponent().cam = camer;*
by making a "public" Camera, you can insert the Main Camera into the generator script. The second starred line gets the script for movement and applies the camera to it, satisfying all its needs.
Im new to this. Is NavMesh how First person shooter games detects if you run into a wall or obstacle?
1) Hasn't a new video with navmesh surfaces links published yet?
2) Can you use the last version (2018) for your next videos? Because, for example, a lot of AI scripts were removed in 2018 and now there is a NavMesh window to set up it.
There seems to be no "NavMeshSurface" type anymore. I'm using 2018.2. Can't really use this video for procedural updating I guess as it has become outdated already.
Got the same problem :/ I wonder what the alternative is
I found the same problem, and figured it out. Here it is:
1) Goto: github.com/Unity-Technologies/NavMeshComponents , download the code;
2) Copy the code into you project folder;
3) Click "GameObject, AI, NavMesh Surface"
You got it!
Ref: docs.unity3d.com/Manual/NavMesh-BuildingComponents.html
Hey. Good evening can i draw or line on navmesh direction. For guide user. Like we see in google map and other apps. thanks.
docs.unity3d.com/ScriptReference/AI.NavMeshPath.html
A part of NavMeshPath is 'corners', which is an array of Vector3 positions. You can use these in something like a trail or linerenderer to create a line that follows the path to guide the user. Hope this helps!
So it would be a bad practice to have a navmesh agent also be a navmesh obstacle?
Not really, considering agents don't calculate another agent in their path until they actually run into it. Better AI would be able to calculate it from a distance "based on sight" if you will.
hey,
this video is missing in Unity Beginner Tutorials
Do you think you could make a navmesh tutorial on pathfinding a moving object instead of the mouse? thatd be really cool for fps ai
Cool the first one helped a lot but this one doesn’t because of the type of game I am making but it was still cool.
If you can make a video about selecting characters because I have more then one nav mesh agent that would be handy but I don’t mind if you dont 😃
Is there an additive version of this? IE: moving platforms the AI can walk on, or adding AI-navigable walls and bridges in an RTS?
- What happens if the character is moving towards some goal when the navmesh is rebuilt?
- Is it possible to place "road objects" making the player faster while on them dynamically?
I haven't tried it yet. So, I was wondering how to make a bunch of enemies that will come for the player but avoid hitting each other.
If we use navmesh obstacle component, won't each enemy think of itself as an obstacle and thus stop moving?
Usually enemies would not be navmesh obstacles, they would be navmesh agents, just like the player character. Instead of them going where you click, their SetDestination target could be the player's current transform.position.
@@MsRedNebulaPlays yes, I understand that part. I'm wondering whether they clip through each other while following the same route.
@@sharif47 As long as they have colliders, they'll avoid eachother. There was another video on the subject called "Crowd Behaviours on a Dynamic Navmesh in Unity" that shows it in action.
Next tutorial A* Pathfinding AI.
Ground & Flying enemies (without ground under it?).
Sebastian Lague has a great tutorial series on making a complex Pathfinding system using A*. I believe it even features multithreading with multiple agents.
Why would you need path finding for flying enemies, unless you have obstacles in the air?
Correct, if the obstacles / walls move and change, the flying enemies should not get stuck.
Also if there is no ground, this can be a problem because usually a ground is needed to calculate the way to move.
But maybe Brackeys have some good work arounds for that.
What I'm saying is, you don't need to take into account the path finding system at all if there are no obstacles in the air. You're just moving a transform from one world position to another, with nothing to stop you.
I know that, thats why i said moving walls and obstacles in the air. ;)
why i get this error??
Source mesh Combined Mesh (root: scene) does not allow read access. This will work in playmode in the editor but not in player
UnityEngine.AI.NavMeshSurface:BuildNavMesh()
Hi.can create a nav mesh in other axis or rotatios?
When I was experimenting with a navmesh, I had a weird occurrence where the agents all gathered into one point as if the goal/target was there. (Maybe I should name it target instead of goal in the script)
Anyone I know why this happened? I had a goal where they gather up and removed it, now there are no goals or targets in the scene and they still gather up like that.
What is sorting layer vs order in layer in unity 2d?
Can you do jumping at different heights?
I have enemies on a boat that is moving so how would I implement that?
Same thing I guess, just set GROUND and WATER in layers 😁
Brackeys can you please do a course of 3d car racing game? There are some tutorials on RUclips about it but either they don't provide valuable information or they are not in high quality.
Please?
hi, is there anyway i can make the player jump on the moving platforms with navmesh? like in platform games
How i can do the field is divided into squares, so that I walk like chess chips on the cages?