Unity AI Patrol, Chase, Attack Tutorial in Less than 8 Minutes(Advanced AI Controller)

  Рет қаралды 96,672

DanCS

DanCS

Күн бұрын

Пікірлер: 255
@anshulsingh8326
@anshulsingh8326 2 жыл бұрын
Things u forgot to mention. Adding waypoints ( just use empty object and place where u want, if u r getting out of bound error). Baking, before backing go to right tab, object, select Navigation static, now bake will work.
@youme2460
@youme2460 2 жыл бұрын
how would you make the enemy ignore you if you are behind it?
@DP-ly3zx
@DP-ly3zx 2 жыл бұрын
you are the man, thanks a lot!
@anshulsingh8326
@anshulsingh8326 2 жыл бұрын
@@youme2460 Just adjust the angle.
@davidsajt40
@davidsajt40 Жыл бұрын
you're a fucking god, thank you
@aciid7968
@aciid7968 Жыл бұрын
do u have to do anything to the empty gameobject or just place it down where u want it?
@thegamingcentre4288
@thegamingcentre4288 3 жыл бұрын
I was not able to find this thing anywhere from last like 4 hours, but just gave a simple yet the best tut out here
@drr1867
@drr1867 2 жыл бұрын
There are loads of tutorials like this - AI cylinders moving around the place. What nobody seems to do is use an animated avatar and show how to use blend trees to control movement and speed for patrolling, chasing and attacking. Anyone know of this I would be grateful.
@wood7465
@wood7465 Жыл бұрын
Did you find something ?
@indiestudio23
@indiestudio23 Жыл бұрын
just add a public animator component in the script and add few bools to the enemy like , walk , chase , attack etc.... and use animator.setbool function in the states of walk,attack and chase. then it will work
@tkc403
@tkc403 2 жыл бұрын
If anyone is having problems with the enemy colliding with the player & it's causing it to drift off by itself. Then you need to set the enemy rigidbody to kinematic 👍 Alternatively, if you don't want your enemy kinematic all the time, add this to your chasing state: (First add a reference to your enemy rigidbody) If(vector3.distance(transform.position, gameobject.findgameobjectwithtag("player").transform.position)
@nickvuono2422
@nickvuono2422 2 жыл бұрын
That will work here. One thing you will eventually want to learn to do is setup the collision layer masks so that certain objects don't collide with your player. The same principles are used in 2d layer collisions like in this tutorial: kzbin.info/www/bejne/l4XRf52bbs9mpZY
@yours_indie_game_dev
@yours_indie_game_dev Жыл бұрын
i think you can also just constrict the position n rotation, its much better
@BobTheBuilder294
@BobTheBuilder294 Жыл бұрын
I had some trouble applying the BAKE because he never said to set the cube to static in the navigation object menu.
@we12man
@we12man 8 ай бұрын
for those who had the same problem: select the ground (or tile) >Navigation > Object > Navigation Static [V] > Navigation Area [Walkable] > Bake > {Bake button}
@santimen2000
@santimen2000 Жыл бұрын
Hey man, everything worked but the enemy is not going back to the patrol waypoints after seeing the player, am i missing something?
@flemi469
@flemi469 7 ай бұрын
on pastebin code is missing!
@simonesansoni3026
@simonesansoni3026 2 жыл бұрын
Isn't there an error at 3:58 that you never fix?
@griddy_shorts638
@griddy_shorts638 2 жыл бұрын
Ikr
@francoisbaron4547
@francoisbaron4547 3 жыл бұрын
Hi. Thanks for the tutorial. That is very helpfull. The "CaughtPlayer()" methode is never used. Is that right ?
@Ryan41707
@Ryan41707 Жыл бұрын
If it's not working for you. He got a some of it incorrect. Some void updates are private. Check the copy-pasted version. There should be a: m_Player is near: on line 40 :/
@Z.R.M24-25
@Z.R.M24-25 7 ай бұрын
I keep on getting errors saying “expected” or “invalid term ‘’” and “Type or namespace definition, or end of life expected” how do I fix this?
@drnovetti9392
@drnovetti9392 2 жыл бұрын
how do i implement for enemies to stop at certain distance from player and start shooting projectiles. Thanks for the really good tutorial though
@michaelgeorge4524
@michaelgeorge4524 2 жыл бұрын
sorry to both but if you found anything that answered this question, please send it my way
@themattempire42
@themattempire42 Жыл бұрын
So I got it 'mostly' working. After I added some waypoint gameobjects to the waypoint array (which I think was missed in the video?), the guard would walk to the first one, but not the second one. Is anyone else having this issue as well? I did note a script below making sure that the nextpoint loops back to the first one, but this doesn't seem to be the problem in regards to getting to the second waypoint...
@svedalawoodcrafts
@svedalawoodcrafts Жыл бұрын
I got the same issue. Enemy will go to the 1st waypoint in the list and just stand there.
@techorigin5850
@techorigin5850 Жыл бұрын
Yeah mee to, how did you fix it
@themattempire42
@themattempire42 Жыл бұрын
@@techorigin5850 Was months ago so I forget sorry, can't even remember if I did manage to fix it!
@drakenforge3798
@drakenforge3798 2 жыл бұрын
I'm confused about when (m_playerNear) is true. its set to false on start function so when is it actually set to true.
@yagizdincel
@yagizdincel 2 жыл бұрын
hi i made everything its almost work fine but agent doeasnt go to the patrol points and when ı got out his range it says "object reference not set to an instance of an object" how to fix it did everything right
@moonc7512
@moonc7512 Жыл бұрын
The people who are using this Don't forget to give a tag "Player" to your player controller and Great video!
@lawlessofarabia
@lawlessofarabia Жыл бұрын
I tried this but for some reason the AI will still follow the Waypoints and ignore me :((
@nickw6969
@nickw6969 2 жыл бұрын
I'm getting very confused on 5:35 I made the layers but have no idea what to do. My enemy capsule is just rolling around like a normal rigid body. For my player I used unitys first person template and renamed the player capsule to Player. I know I've done something wrong or missed something important.
@V0rtex66
@V0rtex66 2 жыл бұрын
my character stops at the first point, I did everything as shown in the video. Has anyone had a similar problem?
@shang_psycho7414
@shang_psycho7414 2 жыл бұрын
Same.
@GoddessOfSpring
@GoddessOfSpring 3 жыл бұрын
I got you for that 50th subscriber! :3 Thanks for the super easy to follow tutorial and i'll be using this into my game!
@DanCSS
@DanCSS 3 жыл бұрын
Thank you
@jacobmarshall379
@jacobmarshall379 2 жыл бұрын
I have 2 issues, the enemy moves through my obstacles when it patrols but once it starts following me it starts having collision with them, also once it follows me and i break line of sight it never goes back to patroling, any suggestions?
@Bendyliam18
@Bendyliam18 Жыл бұрын
Can you please make a tutorial on how to make it animated please
@someonenamedegg1844
@someonenamedegg1844 11 ай бұрын
I have problem, every time I get out of the enemys "chase" stage, the game stops and says "object refrence was not set to an instance of an object. guess the enemy gets mad when he cant see me
@wwinnicki9230
@wwinnicki9230 2 жыл бұрын
um, when i get out of sight for the ai and it's supposed to go patroll from the first waypoint it just walks in place(i added an animation) and doesn't go to the waypoint until it sees me agaun. please help
@by_Leo037
@by_Leo037 2 жыл бұрын
I copy and pasted my code in, and everything was working fine, but there was always an error saying that the index out of bounds of the array. Also my 3d model that I had attached the AI too wasn't following or moving or anything. I followed the tutorial exactly, with doing the baking and everything, and the model will move, but only if I push it with my character. It won't follow me or patrol.
@DanCSS
@DanCSS 2 жыл бұрын
Are you sure that you copied the inspector that I have?
@by_Leo037
@by_Leo037 2 жыл бұрын
@@DanCSS I wasn't baking/static the floor correctly. I have multiple platforms to form the shape of my floor, so I needed to bake them all. It is fixed, and the code works perfectly! The only thing is that the index error still pops up, though it doesn't affect the code. Also unity is being buggy and my POV controls froze, but I just restarted. In general, is there a reason certain aspects of your game will stop working when others are put in?
@by_Leo037
@by_Leo037 2 жыл бұрын
@@DanCSS Also I subbed, because your content is great!
@DanCSS
@DanCSS 2 жыл бұрын
@@by_Leo037 thank you man, that really means a lot!
@DanCSS
@DanCSS 2 жыл бұрын
@@by_Leo037 Sometimes Unity just needs a restart. There is sometimes bugs in the console but you can play and everything works out, so a restart once in a while does help.
@JCWeller
@JCWeller Жыл бұрын
Doesnt work, I did everything the video told me and the enemy doesnt move. You probably shouldn't speed through teaching AI since its a complex thing.
@Ekmnstein
@Ekmnstein 5 ай бұрын
Mad because bad
@kirillvpgames4932
@kirillvpgames4932 2 жыл бұрын
I almost always have an enemy stuck in a corner and run in place if the player turns around the corner during the chase. He does this until he walks back or walks out of the corner. What to do?
@emirozdemir7339
@emirozdemir7339 2 жыл бұрын
Make the capsule collider smaller
@MaZyYTube
@MaZyYTube 2 жыл бұрын
To make more pro like you should split the parts like component based design works. Patroling, Playerfinder, MovementScript. The player finder can use unityevents like if you find target disable patrol Script if you lose target enable again. Patrol script would send next position to movement script and playerfinder as well.
@mikeYagop
@mikeYagop 2 жыл бұрын
IndexOutOfRangeException: Index was outside the bounds of the array.
@sillioskari2109
@sillioskari2109 2 жыл бұрын
same
@priestartor9065
@priestartor9065 2 жыл бұрын
@@sillioskari2109 You need to put in transforms in your Waypoints array
@mluthfiridho1505
@mluthfiridho1505 2 жыл бұрын
Can i use this method to unity standard asset third person character?
@IapitusMcHeimer
@IapitusMcHeimer 2 жыл бұрын
Hey for some reason I am getting an error that the index is outside the bounds of the array for waypoints
@priestartor9065
@priestartor9065 2 жыл бұрын
You need to put in transforms in your Waypoints array
@yackasone
@yackasone 2 жыл бұрын
@@priestartor9065 Sorry to bother but can you specify how to add transforms? I don't understand the syntax. I keep trying to set Transform[] equal to an empty game object but that obviously doesn't work.
@priestartor9065
@priestartor9065 2 жыл бұрын
@@yackasone I think you should have the transforms array public then in the inspector drag in the GameObjects that you use for waypoints. Hope that helps
@jamesmamauag1974
@jamesmamauag1974 Жыл бұрын
do you have the full version of tutorial i didnt follow some steps like im lost
@KBforJesusChrist
@KBforJesusChrist 2 жыл бұрын
I'm looking for videos that have the enemy ai animation snapping back when it loops i can't fix this no one is talking about it 😐
@notanegg7368
@notanegg7368 11 ай бұрын
so im having a problem, I copy and pasted the script but it says "Index was outside the bounds of the array" any idea what this means? (its on line 50 and line 121)
@someonenamedegg1844
@someonenamedegg1844 11 ай бұрын
you might have to add waypoints
@senormgaming2531
@senormgaming2531 2 жыл бұрын
Hey this is my first time making a game so I am a beginner at making games right now. I have downloaded the script and want to ask a question how/where should I edit the code to where when the enemy AI touches the player a event happens like game ends, game over, or something tells me that such event happen. Please and Thank you.
@DanCSS
@DanCSS 2 жыл бұрын
You would do that on the on trigger event, or the on collision event. These two are simillar but not the same. You can check unity docs for things like that. Don’t be afraid to google everything, and also watch youtube videos where people explain to you the basics like controlling the inspector, or doing small things like that. There are good beginner tutorials on unity so make sure you familliarize yourself with tags, gameobjects, rigidbodies so you know how the engine works.
@senormgaming2531
@senormgaming2531 2 жыл бұрын
@@DanCSS Thank you for replying man, appreciated it.
@EvaLunaAlvarezCalderon
@EvaLunaAlvarezCalderon Ай бұрын
Why would you use White background for the code man!
@blezzeth5283
@blezzeth5283 2 жыл бұрын
Thanks you so much, after a few hours of making mistakes I finally made it work!
@williams.n.9443
@williams.n.9443 3 жыл бұрын
how is created the array? I've never delt with it before so now i'm a little lost, i tried Unity documents but they don't teach about this
@Wayloz
@Wayloz 2 жыл бұрын
They do: docs.unity3d.com/2020.1/Documentation/ScriptReference/Array.html
@xxlenzgamingxx4018
@xxlenzgamingxx4018 2 жыл бұрын
How can i fix that the enemy goes back to Patrolling after he loses me
@beegii7222
@beegii7222 Жыл бұрын
it gives me this error Index Out Of Range and my enemy model is getting gone
@noxtorious2962
@noxtorious2962 2 жыл бұрын
so how to do a function where when u are caught something will be triggered?
@frankieplayzz8382
@frankieplayzz8382 9 ай бұрын
i know this is old video but does anyone know how to fix error m_Ispatrol does not exist lines 187,21
@filipurevic1969
@filipurevic1969 2 жыл бұрын
I have been looking for a long time on a good tutorial and im happy to say that I finally found one.Really easy to follow and upgrade with my own code. THANK YOU!
@dclxviclan
@dclxviclan 2 жыл бұрын
I create this tutorial, but agent go in 1 point in 4, and not deteched player, why this maybe? My player use character controller, this can be because my player haven't rigidbody?
@BornthrupiecesEntertainment
@BornthrupiecesEntertainment 2 жыл бұрын
How do you add animation the script or in turn just drop a script for US to access it you can as well tell us here
@ilhamnarendra770
@ilhamnarendra770 Жыл бұрын
is there any way that i can loop the patrol?, mine is not looping
@aciid7968
@aciid7968 Жыл бұрын
instead of the enemy going to me, it goes to the waypoints, and completely goes around me. does anyone have a solution?
@Dwon98
@Dwon98 2 жыл бұрын
How to fix IndexOutOfRangeException: Index was outside the bounds of the array Error..Please help me :(
@xezienstudios
@xezienstudios 2 жыл бұрын
What if i wanted to add a value called isHidden and when the AI is chasing the player and the isHidden value inside the player turns true the AI suddenly goes back to patrolling ?
@AquilaPebble
@AquilaPebble Жыл бұрын
What does IndexOutOfRangeException: Index was outside the bounds of the array. aiController.Patrolling() mean?
@villocity5794
@villocity5794 Жыл бұрын
Hey Ive been having the same issue. I was just wondering if you ever found out what the problem was.
@FWpapo
@FWpapo Жыл бұрын
@@villocity5794 u have to assign patrol points.Empty gameobjects into waypoints in editor. Array is empty thats why u get this error
@tacticalmythic7945
@tacticalmythic7945 2 жыл бұрын
how to I change the radius of the AI. Like if I want the AI to stop within like 1.5 radius of the player so it's not pushing the player trying to get to the center of the transform? edit: I fixed it with adding this... if (Vector3.Distance (enemy.transform.position, player.transform.position) < radiusofNearPlayer) { CaughtPlayer(); } else if(Vector3.Distance (enemy.transform.position, player.transform.position) >= radiusofNearPlayer) { playerLeftRadius(); } ,but the AI takes about 2 - 3 seconds to slow down even inside the radius of the player. The radiusofNearPlayer us just a public float so I can change values in the inspector. Any help would be great!
@DanCSS
@DanCSS 2 жыл бұрын
You can change the stopping distance on the nav mesh agent in the enemy inspector
@tacticalmythic7945
@tacticalmythic7945 2 жыл бұрын
@@DanCSS wow just saw your comment lol after I came up the a different method that still took a while to register in the area like to slow down. Anyway, thanks for your help! There is one last issue... If my player hits him with my hands (I am in VR) (just a mesh with a rigidbody and mesh collider) the AI will then keep going forever in the direction I hit the AI and won't stop and start moving again. How do I solve this? Thanks, also just subbed!
@DanCSS
@DanCSS 2 жыл бұрын
@@tacticalmythic7945 you can maybe put an animation after the enemy gets hit, or maybe make some sort of cooldown. I think I googled how to do a simple cooldown when I did my project. Maybe make a method that detects if the enemy has been hit, put a cooldown and then continue.
@tacticalmythic7945
@tacticalmythic7945 2 жыл бұрын
thanks. I found my own method. Now I am stuck where the player is moving away and the enemy is still attacking while moving. using nav mesh. Basically it attacks when the player is at the stopping distance (when its still). I then have the player move, but the animation attacking is still playing and moving. Instead of waiting for the animation to finish, then start movin again.
@tkc403
@tkc403 2 жыл бұрын
If anyone else is struggling with this, alternatively you can make the enemy kinematic when it gets close to the player to avoid the collision causing it to glitch out
@johnharryduavis3414
@johnharryduavis3414 2 жыл бұрын
can you make a guide on how to add animation with this AI Script
@lexvangastel3285
@lexvangastel3285 2 жыл бұрын
I got a error because of the waypoints. It says IndexOutOfRangeExpection: Index was outside the bounds of the array. Can anyone help
@KSHIVA-ud6lq
@KSHIVA-ud6lq 2 жыл бұрын
Add object anywhere Set the objects as waypoint in ai script
@KineticProduction
@KineticProduction 2 жыл бұрын
Is there any way to make clone of enemy ? With singal AI script, also hit sound damage sound and AI sounds
@shang_psycho7414
@shang_psycho7414 2 жыл бұрын
I got an error. "The name "player" does not exist in the current context." It's in Void Environment View. The guy making it got an error, but it doesn't show us him fixing it! Edit: I found the script in the description and it works.
@VIKHR9x39
@VIKHR9x39 2 жыл бұрын
you see the } above it move it below the if statement
@shang_psycho7414
@shang_psycho7414 2 жыл бұрын
@@VIKHR9x39 Edit: I found out earlier that he made a pastebin script which fixed the error.
@damarfikrihaikal6829
@damarfikrihaikal6829 2 жыл бұрын
do you know why its out of bound? i dont know how to adding waypoit
@dawoodamir7gaming109
@dawoodamir7gaming109 2 жыл бұрын
can you show us a script of the animations please?
@DanCSS
@DanCSS 2 жыл бұрын
I will try to make that video soon since a lot of people are interested in it.
@dak5327
@dak5327 Жыл бұрын
Does anyone else have the problem of the AI shaking once it touches an object with the layers "Obstacle" or "Player"? For me it just shakes and stands there without returning to the waypoint. Wondering if anyone has a fix for this, thanks!
@felixljung1662
@felixljung1662 8 ай бұрын
Rigidbody -> is Kinematic -> True
@samisalama3033
@samisalama3033 2 жыл бұрын
great tutorial, but what do i have to put on the waypoints array?
@lehmus4308
@lehmus4308 2 жыл бұрын
I have the same problem.
@emptybruh
@emptybruh 2 жыл бұрын
@@lehmus4308 Anything you want, a gameobject, gizmo, prefab..
@aciid7968
@aciid7968 Жыл бұрын
how do i fix out of bounds of the array error
@gokayiseri446
@gokayiseri446 2 жыл бұрын
It doesn't work how many times I try. It gives index error.
@imDIEGOOyt
@imDIEGOOyt 2 жыл бұрын
My AI just go to the first checkpoint and don't go to the next one, it just go back and forth in the same checkpoint. I copy pasted the script. Anyone knows how to fix it?
@clotton2481
@clotton2481 2 жыл бұрын
Thank you so much for this awsome tutorial!!
@hiroshin1760
@hiroshin1760 2 жыл бұрын
can anyone explain where i put the AIControler script at? im using it to Enemy but seems like i make a mistake at it, so maybe can anyone tell me how to use it, please?
@MarvelousMemerMan
@MarvelousMemerMan 2 ай бұрын
if this works for anyone, please give me the script because i have an error in mine that I can't find and I dont have the time to redo the entire thing, i just need you to copy and paste the script in the replys or something like that and if you did it would make my day, week, and possibly month because i have tried so many different videos and nothing works, while this is such a huge part of my game, please help me!!! (i would just copy from the paste bin link but the forum has been deleted) my error: the name 'player' does not exist in the current context
@dariusdavid7555
@dariusdavid7555 2 жыл бұрын
how do i make the terrain walkable in 2d orthographic view
@Sponge2212
@Sponge2212 2 жыл бұрын
Does this work for 2D?
@lordmaximus7393
@lordmaximus7393 2 жыл бұрын
Hopefully you see this! I love the script but my one issue is that my obstacles all disappear in game view and i can not understand why, if you could help that would be awesome!
@Litto_037
@Litto_037 2 жыл бұрын
Can i get some help getting this ai to work it wont go to the way points or chase the player it is literally driving me mad
@we12man
@we12man 8 ай бұрын
I had a problem with this script having my 'monster' stuck at players last position, never returning to the waypoint patrolling. That is the solution I just found after diving into the script and having many prints trying to identify what the problem was. It solved the problem but it depends on the player being away from the ViewRadius for the m_waitTime amount: at environment () if (Vector3.Distance (transform.position, player.position) > viewRadius) { //print ("EnviromentView = Vector3.Distance (transform.position, player.position) > viewRadius"); m_PlayerInRange = false; m_PlayerPosition = Vector3.zero; // this zero player last seen position navMeshAgent.SetDestination (waypoints [m_CurrentWaypointIndex].position); //forces AI to return to waypoint patrolling I will comment after this one if I find any other better solution. But, It will at least force your AI to return to patrol if player is away from the view radius, which I believe might serve most of the purposes.
@janajames992
@janajames992 2 жыл бұрын
I tried but it was too hard and it wouldn’t work
@chilla124
@chilla124 2 жыл бұрын
Hey Dan, I have been able to implement your code into my game but I am noticing there is no actual attack code within it. Would you be able to create a short video how to add attack code to the script so my enemy ai is able to attack in melee range? Thanks again for the quick and clear video, you definitely earned a sub!
@DanCSS
@DanCSS 2 жыл бұрын
There is a video on my channel called how to make combo attack which connects to this
@simplesolnforusualignorede6232
@simplesolnforusualignorede6232 Жыл бұрын
Ahh understood have to add the elements to the wayPoints
@DadoEsko
@DadoEsko Жыл бұрын
how to set waypoints loop ?
@DaV1nk
@DaV1nk 3 жыл бұрын
Great tutorial man! Thank you!
@BradExplains
@BradExplains 2 жыл бұрын
Hey, I dropped a message in your discord. Unfortunately I've been having some issues with getting this working. It looks like the GetComponent for the NavMesh is being reset each time. Not sure if this is due to an update in how Unity operates now
@MrPlazma
@MrPlazma 2 жыл бұрын
Thank you so much bro, it helped me a lot. I can build on this code to make my own monster enemy in my horror game. Thanks :D
@coldspine3697
@coldspine3697 Жыл бұрын
"Couple of bools...."
@ilypavan
@ilypavan Жыл бұрын
Do you know who's Joe?
@boyar3033
@boyar3033 Жыл бұрын
Does anyone have an idea about the waypoints ? Do I need to manually add them ?
@botcomborderreaching3518
@botcomborderreaching3518 2 жыл бұрын
Good tutorial. But what if you play with friends and everybody are in AI view?
@netofranc
@netofranc 3 жыл бұрын
My enemy is stopping on the Fourth waypoint... And i don't know why.
@DanCSS
@DanCSS 3 жыл бұрын
Make sure you check the code again, maybe you missed something?
@netofranc
@netofranc 3 жыл бұрын
@@DanCSS sorry man, i literally Just copy and paste your code from pastebin. I didn't make any changes
@netofranc
@netofranc 3 жыл бұрын
@@DanCSS but I'll see what i can do
@DaV1nk
@DaV1nk 3 жыл бұрын
I found the issue! In the NextPoint function it's only set to continually go the next point in the list, not to loop. I'm not the best programmer so the code might be super messy but here's how I fixed the issue. (Side note 5 is just the number I had for testing, set it to 1 greater than the last point in your list, then add 1 extra point and it should start looping) public void NextPoint() { if(m_CurrentWaypointIndex >= 5) { m_CurrentWaypointIndex = 0; } else { m_CurrentWaypointIndex = (m_CurrentWaypointIndex + 1) % waypoints.Length; navMeshAgent.SetDestination(waypoints[m_CurrentWaypointIndex].position); } }
@DanCSS
@DanCSS 3 жыл бұрын
@@DaV1nk Thanks for the fix!
@xrono6003
@xrono6003 2 жыл бұрын
Hi, instead of chasing me, the enemy runs away from me?! please help
@DanCSS
@DanCSS 2 жыл бұрын
Make sure you got all of the code copied correctly
@xrono6003
@xrono6003 2 жыл бұрын
@@DanCSS i did, i copied it from your website. And it didnt show any errors. Di you do something in the video that wasnt in the code to copy
@DanCSS
@DanCSS 2 жыл бұрын
@@xrono6003 I didn't, but if you have problems you can download the entire script on the discord. Maybe that will help.
@azaindaboss9384
@azaindaboss9384 2 жыл бұрын
yay im the 200th subscriber
@DanCSS
@DanCSS 2 жыл бұрын
Thankss!!
@flemi469
@flemi469 7 ай бұрын
My AI sees me through my back!
@retrovoorhees8160
@retrovoorhees8160 2 жыл бұрын
Nice video! My only question is that if I could somehow add the CaughtPlayer() function to the script like, if the enemy is close to the player then call the CaughPlayer function, thanks!
@jakubkozelka8238
@jakubkozelka8238 2 жыл бұрын
Hi, sorry, probably late answer. I am still new into coding, just had an idea to maybe do it through collider? So when enemy enters collider (around player), then freeze all movement for player and enemy? But that's probably really basic, you want something more complex I guess.
@retrovoorhees8160
@retrovoorhees8160 2 жыл бұрын
Thanks for the idea but the player wouldn’t be able to go close to things, I already solved the problem, what I did was change the “Stop Distance” (I think thts what it’s called) to 20 so he stops 20 units away from the player, you can set this number to whatever you want and he will stop at that distance Thank you for answering! :)
@jakubkozelka8238
@jakubkozelka8238 2 жыл бұрын
@@retrovoorhees8160 No problem, glad you figured it out. :)
@KSHIVA-ud6lq
@KSHIVA-ud6lq 2 жыл бұрын
@@retrovoorhees8160 can you please mention in code where did you changed
@alfonzo1
@alfonzo1 2 жыл бұрын
my ai keeps turning to face the floor instead of being upright
@NRWPmusic
@NRWPmusic 2 жыл бұрын
Great tutorial!! Thank you so much!!
@AnotherDumbAnimater
@AnotherDumbAnimater 5 ай бұрын
where the hell is nav mesh agent
@benediktasstundzia3022
@benediktasstundzia3022 2 жыл бұрын
Why isnt there NavMeshAgent on my screen?
@DanCSS
@DanCSS 2 жыл бұрын
You have to add it as a component
@causticlasagne5497
@causticlasagne5497 2 жыл бұрын
You earned it with this one! +1 sub.
@adrialara9747
@adrialara9747 3 жыл бұрын
but you dont show how ti implement bools with animations bro
@DanCSS
@DanCSS 3 жыл бұрын
I can put a script with my animations and you can see how it would work if that helps?
@adrialara9747
@adrialara9747 3 жыл бұрын
@@DanCSS yes please that would be awesome
@tacticalmythic7945
@tacticalmythic7945 2 жыл бұрын
@Music KZbin hey if you want I already did it! If you want I might be able to help you :)
@DanCSS
@DanCSS 2 жыл бұрын
@Music KZbin I added it to the discord!
@tacticalmythic7945
@tacticalmythic7945 2 жыл бұрын
@Music KZbin sure what’s ur discord name?
@nightcrow578
@nightcrow578 Жыл бұрын
please help me, i used your code, its running but i got a error it says "index out of range exception unity", what should i do?
@someonenamedegg1844
@someonenamedegg1844 11 ай бұрын
fixed it yet? if you didnt, the solution is to add empty game objects as waypoints, put them around in your floor, and go to the script inside the enemy, on the bottom of the script tag, there should be "Waypoints" open it, add a few, and implement the empty game objects into the things
@Ananas7868
@Ananas7868 Жыл бұрын
where tf did you find the AI in window?
@thepurplelight1717
@thepurplelight1717 5 ай бұрын
You download the AI Navigation package but the version he's showing is outdated so you might need another tutorial, this video is really weird :/
@thepurplelight1717
@thepurplelight1717 5 ай бұрын
"Tutorial in less than 8 minutes" cause you sped it up 10x 😭
@ВадимИванов-э5у
@ВадимИванов-э5у 2 жыл бұрын
I would like to see character mouse look script and walking.
@GodpostalRemik
@GodpostalRemik 2 жыл бұрын
How do I make a attack pls
@DanCSS
@DanCSS 2 жыл бұрын
I made a seperate video on combo attacks
@GodpostalRemik
@GodpostalRemik 2 жыл бұрын
@@DanCSS Tq bro my AI spin around can I fix this issue
@cepfathir7829
@cepfathir7829 3 жыл бұрын
Hi bro, can you add a animation?
@DanCSS
@DanCSS 3 жыл бұрын
I can put a script with my animations and you can see how it would work if that helps?
@barbarabc5
@barbarabc5 3 жыл бұрын
@@DanCSS I would like to see this too, where can I view this animation script? Thank you :)
@asti8836
@asti8836 2 жыл бұрын
@@DanCSS can you reset the animation script to your group in discord? that would be very cool!
@DanCSS
@DanCSS 2 жыл бұрын
I added the animation script on the discord with some explanation, if you have any more questions you can ask me to make another video on it!
@DanCSS
@DanCSS 2 жыл бұрын
@@barbarabc5 I added it to the discord!
@dark_teddy
@dark_teddy 2 жыл бұрын
hey how to add the waypoints?
@chilla124
@chilla124 2 жыл бұрын
Create empty game objects and call it a waypoint, then place those where you want your enemy to patrol. After that just assign those waypoints to the waypoint list in the inspector component of the script.
@blezzeth5283
@blezzeth5283 2 жыл бұрын
@@chilla124 thats cool and all, I dont get errors anymore, but the enemy stays like a tree if I don't go next to it to start a chase sequence
@character726
@character726 Жыл бұрын
Pleease help,how do you add navmesh to unity i down fucking understand.
@MatheusOliveira-fu8rs
@MatheusOliveira-fu8rs 2 жыл бұрын
The enemy justo don't follow and pattrol, and i copy exactly the code of the video
@benavkahlo7646
@benavkahlo7646 3 жыл бұрын
hello, you can do a long tutorial video ... but please correct. I typed everything and without any errors. but it doesn't work. I think this is only made for your game and not for fps. thanks
@tacticalmythic7945
@tacticalmythic7945 2 жыл бұрын
wtf u talking about? his tutorial works fine and I am doing it for VR? You clearly don't know what u are doing
@Nemko77
@Nemko77 2 жыл бұрын
I'm use in it an fps as well. What he didn't show is setting the things in the inscepctor menu. Add the player and obstacle masks - unti this point he show it, and create two(or more) object for patrol waypoints and add them as waypoints. The only issue what I have right now is my enemy don't stop the running animations when reach the player.
7 UNITY ASSETS YOU NEED IN YOUR PROJECT NOW
6:12
DanCS
Рет қаралды 2,6 М.
ENEMY AI - Making an RPG in Unity (E10)
9:25
Brackeys
Рет қаралды 539 М.
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 2,7 МЛН
黑天使被操控了#short #angel #clown
00:40
Super Beauty team
Рет қаралды 61 МЛН
Can I Make QR Code Damascus?
19:23
Alec Steele
Рет қаралды 469 М.
How to Add a Field of View for Your Enemies [Unity Tutorial]
23:45
Comp-3 Interactive
Рет қаралды 91 М.
How to Make a Real Diamond - (Not Clickbait)
8:51
JerryRigEverything
Рет қаралды 1,4 МЛН
3D ENEMY AI in UNITY - (E01): STATE MACHINE BEHAVIORS
17:24
GDTitans
Рет қаралды 56 М.
FULL 3D ENEMY AI in 6 MINUTES! || Unity Tutorial
5:52
Dave / GameDevelopment
Рет қаралды 657 М.
How to code SMARTER A.I. enemies | Unity Tutorial
32:49
This is GameDev
Рет қаралды 61 М.
How to use Unity NavMesh Pathfinding! (Unity Tutorial)
15:25
Code Monkey
Рет қаралды 216 М.
Creating your first animated AI Character! [AI #01]
22:11
TheKiwiCoder
Рет қаралды 116 М.
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН