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

Поделиться
HTML-код
  • Опубликовано: 19 июн 2024
  • In this tutorial I'll show how you can make an advanced AI controller, making your enemy patrol, chase and attack! SUBSCRIBE for more tutorials :)
    Join the Patreon for special access →→ / danncs
    Join the discord server →→ / discord
    Script: pastebin.com/WGWfA705
    Instagram: / officialdancs
    Facebook: / dancs-101265175484128
    Music: / @freemusicc
    Chapters:
    0:00 Intro
    0:19 Start!
    1:05 The Script!!
    5:35 Finished Script!
    6:10 How does it look??
    About me
    Hey! I'm an indie game developer, currently working on a mobile survival game in Unity. This is my devlog where I show off the progress and I'll upload once a week!
  • НаукаНаука

Комментарии • 245

  • @thegamingcentre4288
    @thegamingcentre4288 2 года назад +7

    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

  • @anshulsingh8326
    @anshulsingh8326 Год назад +35

    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 Год назад +1

      how would you make the enemy ignore you if you are behind it?

    • @DP-ly3zx
      @DP-ly3zx Год назад +4

      you are the man, thanks a lot!

    • @anshulsingh8326
      @anshulsingh8326 Год назад +2

      @@youme2460 Just adjust the angle.

    • @davidsajt40
      @davidsajt40 Год назад +3

      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?

  • @blezzeth5283
    @blezzeth5283 Год назад +2

    Thanks you so much, after a few hours of making mistakes I finally made it work!

  • @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!

  • @DaV1nk
    @DaV1nk 2 года назад +2

    Great tutorial man! Thank you!

  • @clotton2481
    @clotton2481 Год назад +1

    Thank you so much for this awsome tutorial!!

  • @mayflowerstudiosinc.2734
    @mayflowerstudiosinc.2734 Год назад

    Great tutorial!! Thank you so much!!

  • @MrPlazma
    @MrPlazma Год назад

    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

  • @GoddessOfSpring
    @GoddessOfSpring 2 года назад +8

    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  2 года назад

      Thank you

  • @yagizdincel
    @yagizdincel Год назад

    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

  • @MaZyYTube
    @MaZyYTube Год назад +1

    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.

  • @drr1867
    @drr1867 Год назад +49

    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 Год назад +1

      Did you find something ?

    • @indiestudio23
      @indiestudio23 11 месяцев назад +8

      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

  • @francoisbaron4547
    @francoisbaron4547 2 года назад +8

    Hi. Thanks for the tutorial. That is very helpfull. The "CaughtPlayer()" methode is never used. Is that right ?

  • @causticlasagne5497
    @causticlasagne5497 2 года назад

    You earned it with this one! +1 sub.

  • @GodpostalRemik
    @GodpostalRemik 2 года назад

    keep ur good work brother luv

  • @jacobmarshall379
    @jacobmarshall379 Год назад +3

    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?

  • @nickw6969
    @nickw6969 Год назад +4

    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.

  • @JCWeller
    @JCWeller Год назад +6

    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.

  • @notwicio9230
    @notwicio9230 2 года назад +1

    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

  • @tkc403
    @tkc403 2 года назад +14

    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 года назад +1

      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: ruclips.net/video/aTnNje9j3o4/видео.html

    • @yours_indie_game_dev
      @yours_indie_game_dev 9 месяцев назад

      i think you can also just constrict the position n rotation, its much better

  • @santimen2000
    @santimen2000 11 месяцев назад +1

    Hey man, everything worked but the enemy is not going back to the patrol waypoints after seeing the player, am i missing something?

  • @uncleboby5952
    @uncleboby5952 2 года назад

    do you have problems with EnemyAI triggering NavMesh.SetDestination lagging or freezing the game for a few seconds? I do

  • @chilla124
    @chilla124 2 года назад +3

    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 года назад +5

      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

  • @xezienstudios
    @xezienstudios Год назад

    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 ?

  • @mluthfiridho1505
    @mluthfiridho1505 Год назад +1

    Can i use this method to unity standard asset third person character?

  • @kirillvpgames4932
    @kirillvpgames4932 Год назад +1

    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?

  • @drakenforge3798
    @drakenforge3798 2 года назад +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.

  • @BobTheBuilder294
    @BobTheBuilder294 Год назад +7

    I had some trouble applying the BAKE because he never said to set the cube to static in the navigation object menu.

    • @we12man
      @we12man 2 месяца назад

      for those who had the same problem: select the ground (or tile) >Navigation > Object > Navigation Static [V] > Navigation Area [Walkable] > Bake > {Bake button}

  • @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 Год назад

      sorry to both but if you found anything that answered this question, please send it my way

  • @lordmaximus7393
    @lordmaximus7393 Год назад

    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!

  • @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

  • @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?

  • @Z.R.M23-24
    @Z.R.M23-24 Месяц назад +1

    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?

  • @BornthrupiecesEntertainment
    @BornthrupiecesEntertainment Год назад

    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

  • @jamesmamauag1974
    @jamesmamauag1974 Год назад

    do you have the full version of tutorial i didnt follow some steps like im lost

  • @widow7512
    @widow7512 Год назад +3

    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 :((

  • @michaelkraft3139
    @michaelkraft3139 Год назад

    This is a great tutorial! Although I am implementing this into my 2D game, and am having some trouble modifying the script so that it works within Unity's 2D NavMesh. Does anyone have any suggestions at how to modify this script for a 2D game in Unity? I have already tried substituting all of the Vector3's to Vector2's in the script and that doesn't seem to work. Thank you!

  • @someonenamedegg1844
    @someonenamedegg1844 5 месяцев назад

    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

  • @KineticProduction
    @KineticProduction Год назад

    Is there any way to make clone of enemy ? With singal AI script, also hit sound damage sound and AI sounds

  • @botcomborderreaching3518
    @botcomborderreaching3518 Год назад

    Good tutorial. But what if you play with friends and everybody are in AI view?

  • @hiroshin1760
    @hiroshin1760 Год назад

    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?

  • @williams.n.9443
    @williams.n.9443 2 года назад +1

    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

  • @azaindaboss9384
    @azaindaboss9384 2 года назад

    yay im the 200th subscriber

    • @DanCSS
      @DanCSS  2 года назад +1

      Thankss!!

  • @senormgaming2531
    @senormgaming2531 2 года назад +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 года назад +1

      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 года назад +1

      @@DanCSS Thank you for replying man, appreciated it.

  • @notanegg7368
    @notanegg7368 5 месяцев назад

    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)

  • @ilhamnarendra770
    @ilhamnarendra770 10 месяцев назад

    is there any way that i can loop the patrol?, mine is not looping

  • @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 Год назад

      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 Год назад +1

      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 Год назад

      @@retrovoorhees8160 No problem, glad you figured it out. :)

    • @KSHIVA-ud6lq
      @KSHIVA-ud6lq Год назад

      @@retrovoorhees8160 can you please mention in code where did you changed

  • @damarfikrihaikal6829
    @damarfikrihaikal6829 Год назад

    do you know why its out of bound? i dont know how to adding waypoit

  • @Bendyliam18
    @Bendyliam18 Год назад +1

    Can you please make a tutorial on how to make it animated please

  • @samisalama3033
    @samisalama3033 2 года назад +2

    great tutorial, but what do i have to put on the waypoints array?

    • @lehmus4308
      @lehmus4308 2 года назад

      I have the same problem.

    • @emptybruh
      @emptybruh Год назад

      @@lehmus4308 Anything you want, a gameobject, gizmo, prefab..

  • @noxtorious2962
    @noxtorious2962 Год назад

    so how to do a function where when u are caught something will be triggered?

  • @EmiliaKaida
    @EmiliaKaida 2 года назад

    What are the models you are using ?

    • @DanCSS
      @DanCSS  2 года назад

      You can find models on mixamo, I made a video on mixamo a while back so you can check it out aswell

  • @dariusdavid7555
    @dariusdavid7555 Год назад

    how do i make the terrain walkable in 2d orthographic view

  • @Ryan41707
    @Ryan41707 Год назад +1

    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
    :/

  • @Dwon98
    @Dwon98 Год назад

    How to fix IndexOutOfRangeException: Index was outside the bounds of the array Error..Please help me :(

  • @xxlenzgamingxx4018
    @xxlenzgamingxx4018 Год назад

    How can i fix that the enemy goes back to Patrolling after he loses me

  • @simonesansoni3026
    @simonesansoni3026 2 года назад +4

    Isn't there an error at 3:58 that you never fix?

  • @timtrollgasm
    @timtrollgasm 2 года назад

    Not sure what's happening but it seems the enemy works as intended until after he's spotted me and I get a certain distance away from him. Game just crashes at that point

  • @litto3533
    @litto3533 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

  • @aciid7968
    @aciid7968 Год назад

    instead of the enemy going to me, it goes to the waypoints, and completely goes around me. does anyone have a solution?

  • @KBforJesusChrist
    @KBforJesusChrist Год назад

    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 😐

  • @diegoo1713
    @diegoo1713 Год назад

    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?

  • @nightcrow578
    @nightcrow578 7 месяцев назад

    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 5 месяцев назад +1

      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

  • @V0rtex66
    @V0rtex66 Год назад +2

    my character stops at the first point, I did everything as shown in the video. Has anyone had a similar problem?

  • @johnharryduavis3414
    @johnharryduavis3414 Год назад

    can you make a guide on how to add animation with this AI Script

  • @frankieplayzz8382
    @frankieplayzz8382 3 месяца назад

    i know this is old video but does anyone know how to fix error m_Ispatrol does not exist lines 187,21

  • @IapitusMcHeimer
    @IapitusMcHeimer 2 года назад +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 Год назад

      @@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 Год назад

      @@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

  • @themattempire42
    @themattempire42 11 месяцев назад +1

    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...

    • @coregamestudio
      @coregamestudio 7 месяцев назад

      I got the same issue. Enemy will go to the 1st waypoint in the list and just stand there.

    • @techorigin5850
      @techorigin5850 6 месяцев назад

      Yeah mee to, how did you fix it

    • @themattempire42
      @themattempire42 6 месяцев назад

      @@techorigin5850 Was months ago so I forget sorry, can't even remember if I did manage to fix it!

  • @AquilaPebble
    @AquilaPebble Год назад

    What does IndexOutOfRangeException: Index was outside the bounds of the array. aiController.Patrolling() mean?

    • @villocity5794
      @villocity5794 11 месяцев назад

      Hey Ive been having the same issue. I was just wondering if you ever found out what the problem was.

    • @FWpapo
      @FWpapo 8 месяцев назад

      @@villocity5794 u have to assign patrol points.Empty gameobjects into waypoints in editor. Array is empty thats why u get this error

  • @coldspine3697
    @coldspine3697 11 месяцев назад +1

    "Couple of bools...."

  • @beegii7222
    @beegii7222 11 месяцев назад

    it gives me this error Index Out Of Range and my enemy model is getting gone

  • @aciid7968
    @aciid7968 Год назад

    how do i fix out of bounds of the array error

  • @lexvangastel3285
    @lexvangastel3285 Год назад

    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 Год назад

      Add object anywhere
      Set the objects as waypoint in ai script

  • @tacticalmythic7945
    @tacticalmythic7945 2 года назад +1

    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

  • @Mr.YETI.Cinematic
    @Mr.YETI.Cinematic 2 года назад

    Here s one sub

  • @boyar3033
    @boyar3033 Год назад

    Does anyone have an idea about the waypoints ? Do I need to manually add them ?

  • @gokayiseri446
    @gokayiseri446 Год назад

    It doesn't work how many times I try. It gives index error.

  • @slippysix3776
    @slippysix3776 Год назад +1

    Does this work for 2D?

  • @DadoEsko
    @DadoEsko Год назад

    how to set waypoints loop ?

  • @flemi469
    @flemi469 Месяц назад

    My AI sees me through my back!

  • @dak5327
    @dak5327 10 месяцев назад

    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 2 месяца назад

      Rigidbody -> is Kinematic -> True

  • @an5e420
    @an5e420 6 месяцев назад

    where tf did you find the AI in window?

  • @flemi469
    @flemi469 Месяц назад

    on pastebin code is missing!

  • @037productions
    @037productions 2 года назад +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 года назад +2

      Are you sure that you copied the inspector that I have?

    • @037productions
      @037productions 2 года назад +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?

    • @037productions
      @037productions 2 года назад

      @@DanCSS Also I subbed, because your content is great!

    • @DanCSS
      @DanCSS  2 года назад +1

      @@037productions thank you man, that really means a lot!

    • @DanCSS
      @DanCSS  2 года назад +1

      @@037productions 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.

  • @dawoodamir7gaming109
    @dawoodamir7gaming109 2 года назад +2

    can you show us a script of the animations please?

    • @DanCSS
      @DanCSS  2 года назад +5

      I will try to make that video soon since a lot of people are interested in it.

  • @alfonzo1
    @alfonzo1 2 года назад

    my ai keeps turning to face the floor instead of being upright

  • @janajames992
    @janajames992 2 года назад +1

    I tried but it was too hard and it wouldn’t work

  • @mikeYagop
    @mikeYagop 2 года назад +2

    IndexOutOfRangeException: Index was outside the bounds of the array.

  • @shang_psycho7414
    @shang_psycho7414 Год назад

    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 Год назад

      you see the } above it move it below the if statement

    • @shang_psycho7414
      @shang_psycho7414 Год назад

      @@VIKHR9x39 Edit: I found out earlier that he made a pastebin script which fixed the error.

  • @samuelgirmagirma4019
    @samuelgirmagirma4019 2 года назад

    make a video on how to setup the animations pls

    • @DanCSS
      @DanCSS  2 года назад

      I made that video previously on my channel, you can check it out.

  • @user-uy7sn3ze4q
    @user-uy7sn3ze4q 2 года назад

    I would like to see character mouse look script and walking.

  • @emptybruh
    @emptybruh 2 года назад

    Are you Serbian, saw that ž slipup while writing :D

  • @ilypavan
    @ilypavan Год назад

    Do you know who's Joe?

  • @landoncarey8084
    @landoncarey8084 2 года назад

    What about attacking

  • @character726
    @character726 8 месяцев назад

    Pleease help,how do you add navmesh to unity i down fucking understand.

  • @AzureBlue521
    @AzureBlue521 2 года назад

    Can I use this commerically? I also subbed to ur channel ;)

    • @DanCSS
      @DanCSS  2 года назад

      You can

    • @AzureBlue521
      @AzureBlue521 2 года назад

      @@DanCSS THANK YOU SO MUCH!!!

  • @CrystalDev
    @CrystalDev 2 года назад

    how animations?

    • @DanCSS
      @DanCSS  2 года назад

      Check out the discord in the description, it should be there. Or checkout my video I did before.

  • @benediktasstundzia3022
    @benediktasstundzia3022 2 года назад

    Why isnt there NavMeshAgent on my screen?

    • @DanCSS
      @DanCSS  2 года назад

      You have to add it as a component

  • @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.

  • @MatheusOliveira-fu8rs
    @MatheusOliveira-fu8rs Год назад

    The enemy justo don't follow and pattrol, and i copy exactly the code of the video