ENEMY AI - Making an RPG in Unity (E10)
Let’s make some enemies!
❤️ Donate: www.paypal.com/donate/?hosted...
●The Playlist: bit.ly/2xiecdD
● Sebastian's Channel: / cercopithecan
● Download the assets: bit.ly/2u4rcEX
● Download the source code: bit.ly/2uecCew
● Singleton Patterns: wiki.unity3d.com/index.php/Sin...
····················································································
► Join Discord: / discord
♥ Subscribe: bit.ly/1kMekJV
● Website: brackeys.com/
● Facebook: / brackeys
● Twitter: / brackeystweet
····················································································
Edited by the lovely Sofibab.
····················································································
► All content by Brackeys is 100% free. We believe that education should be available for everyone.
❤️ Donate: www.paypal.com/donate/?hosted...
····················································································
♪"Funin and Sunin" Kevin MacLeod (incompetech.com)
Licensed under Creative Commons: By Attribution 3.0 License
creativecommons.org/licenses/b...
♪ Baby Plays Electro Games
teknoaxe.com/cgi-bin/link_code...
Пікірлер: 840
Dude, what you do on youtube.. teaches people for free is just too much...,I'm very grateful to you, all my skills with unity and even learning English I'm getting into these classes, thank you.
@James-zr1lu
5 жыл бұрын
Technically it isn't free. The video is monetized by ads. So, it costs you your time.
@AMBafoon
5 жыл бұрын
James which is more valuable than money if you think about it
@gorgestboi1028
5 жыл бұрын
@Big Smoke PINEAPPLE ON PIZZA IS AMAZING
@mainaody3997
4 жыл бұрын
@@andrewnagengast2349 the pineapples on pizza part got me lol
@pitanga1724
4 жыл бұрын
Mds, achei um BR! Aleluia!!!
If anyone has a set destination error, follow these steps 1. Select your ground and check static on the top right corner of the inspector. 2. Keep your ground selected, and go to the Navigation tab. (Window>AI>Navigation) Then you should see a tab in Navigation called bake. Select it, and click bake on the bottom. 3. Play test your game. It might work it might not. If it doesn't work, follow the next steps. If it does, you are good to go. 4. Move your enemy ai closer to the ground. 5. Play test your game again. It might work it might not. If it doesn't work, follow the next steps. If it does, you are good to go. 6. If your enemy gets stuck in the ground, select your enemy, and in the NavMeshAgent, play around with the base offset. You should see a cylinder. Make that cylinder touch the ground.
@minecraftmadlad3593
3 жыл бұрын
Thanks so much lol
@thundereagle6332
3 жыл бұрын
ya thank you
@laurisdupois8275
3 жыл бұрын
Thanks !!
@sealclips7236
3 жыл бұрын
Thank you so much!
@dcengiz40
3 жыл бұрын
thanks a lot
"if we get closer to our enemy, it will start to chase us, *AWESOME* "
@__Rizzler__
3 жыл бұрын
"Hehe boi u have got some knowledge" - words of an old dog
After all these years I still come back to your videos..... Awesome Job my man !!! Mad Respect !!!
Love this series. It's been a great help with my current project. Keep the coming!
mate you are simply the best everytime i watch a tutorial elsewhere they jugle theyre scripts between episodes so that you have to watch every of theyre episodes but you do a complete video where you explain everything regarding one topic. i love your videos :) you are the best mate keep up the good work you made my day
Man, thank you for making these tutorials! They're top notch quality and very interesting! Keep it up!
@dascience1147
2 жыл бұрын
yes
Man, I love your videos. Especially these RPG ones 👌
just discovered this series now im trying to integrate the parts of these scripts with your tower defense tutorial series to make a 3d kingdom rush type of game, thank a lot for these vids. btw im so new to game development so im really grateful
Thank you so much, Brackeys! I am looking forward to the next part! :D
I can't believe how good you are at explaining!
My days goes awesome when he says "AWESOME!"
Great info on NavMeshes... I was able to get the right information quickly and easily!! Thank you for all of your tutorials.
This is amazing bro!
I love your tutorials! please don't ever stop uploading them
@yo_cham2540
3 жыл бұрын
Sadly he didi
@heartattackonyt
3 жыл бұрын
@@yo_cham2540 yep
Wow what a great channel this is. I've been subbed for sometime and coding interests me. Thanks for the awesome channel! :)
Great work Brackeys!
Awesome video as always. Would loooove to see this be converted to a multiplayer / coop.
This is great! I really love your videos!
Hello. Is it somehow possible to handle rotation on raycast hit as you did for FaceTarget() method? Its buggy and not working as same as clicking on object once facing the target (handling rotation without navmesh agent)
Thank you so much, Where is the video that makes the enemies fight? I couldnt find it
just a great tutorial overall, even though I cannot donate currently I will be sure to share your channel as much as possible
Love these videos, inspirational!
Hi Brackeys, great tutorial. Just one question: Is there any reason why did not use a trigger collider to figure out if the player is within your desired radius?
I'm very new at this, so I don't know if you've answered this b4 but how do you make the enemy have an angle for line of sight
@Brackeys How do I point to my player that I spawned at runtime? I can't use the public method player that you show in the tutorial.
Not to sure why but my target location isnt updated after start. So the enemy will move to the initial player position but not follow the player after the player moves (or if the player is out of the lookRadius). I followed the video, any suggestions?
Man, I love your videos thank you
You're really cool! I love your work. keep up :)
if anyone else had the thing that said "SetDestination can only be called on an active agent that is on a NavMesh." I set the ground as static went to window- AI- Navigation then bakedif that helps
Boom! Thanks bro
Thank you so much for this series! I am actually not using this series to make a RPG. Instead, I am using them, to make a MOBA-style game!
The type or namespace name 'CharacterCombat' could not be found (are you missing a using directive or an assembly reference?) The type or namespace name 'CharacterCombat' could not be found (are you missing a using directive or an assembly reference?) please help
When did the altar object get added? At the start of this video the altar area / ritual area with torches has a platform on it now? Did I miss something?
Let's start to create deep-learning AI enemy.
@thebloocat
3 жыл бұрын
Yeah! You know any good resources for that?
is there another place I can put the player manager beside the game manager since I only need the ai and not the entire
Best tutorial dude, thanks
When everyone makes half hour long ai vids but ya boi asbjørn got ai down
Great Work man ...............
Love this channel!!!
Brackeys you dont have Crafting system video right? i was trying to ... but hard to apply to my inventory its kinda confusing
You and Sebastian help a lot. Thanks for the videos and tutorials. I do not know if they stopped creating videos, and if you still have a chance to collaborate on patreon.
@francek3892
2 жыл бұрын
Sebastians AI for the animations kinda suck bcs he didn't showed how he puted the animations to the enemy I tried it several times and it doesn't work. Like the enemy is attacking but am getting errors for the attack animation
yes! this is what i was looking for!
Are you guys going to handle serialization? (Without the use of PlayerPrefs). How would you save the game data, since you guys are using ScriptableObjects to hold it?
Hello, i have issues with the agent when reaching stopping distance it kinds of sliding sometimes vibrates while sliding.
7:32 The type or namespace name 'Interactable' could not be found (are you missing a using directive or an assembly reference?), I am getting this error
@mosaabmatar4117
2 жыл бұрын
Same here There is no class Named Interactable Its maybe Changed
hi , love your tuts your the best of course. we will be realy happy if you could make us tut on how to make combat ai in hard difficulty
something to note is that if its not working, try going into the PlayerManager script and change (GameObject player) into (Transform player).
u was the best person and u will be on our hurts.
May i ask, will you implement something that saves character data?
Who else got a little spooked when he suddenly plays the music
6:45 why slerp, and not lerp? i know that slerp makes spherical path to the target, but i made 2 ai agents, and put lerp in one and slerp in the other, and saw no difference, it worked nice for me, but i just want to know why, ty Brackeys
when you just want a simple enemy ai and then have to spend a few hours watching his entire series, only for it to break your game
@sevendarsh4082
2 жыл бұрын
lol
Assets\scripts\Enemy.cs(5,22): error CS0246: The type or namespace name 'Interactable' could not be found (are you missing a using directive or an assembly reference?) what am i doing wrong pls answer this time
@Fishing-vr7eh
2 жыл бұрын
Pry a spelling error
so the game I am trying to make, is a sort of zombie wave game, so will all of this stuff still work if I haven't followed any of the other tutorials?
for me when i write OnDrawGizmosSelected it pops up a warning that the (OnDrawGizmosSelected) is declared but never used pls someone help
i am using your script and i get the following error: Assets/EnemyController.cs(15,2): error CS0246: The type or namespace name `CharacterCombat' could not be found. Are you missing an assembly reference? Can someone help me?
Question, when creating a 2d game, has an alternative to NavMeshAgent? Sample, a enemy following the character in 2d platform game.
Thank you!
My enemy stops following the player after some time. and also on that line "using UnityEngine.AI;" i'm geting an error so, when i want the script to work i have to disable that line. I'm using Unity 5.0.1f1. is it because my unity version is older?
I like all of your content 👍Thank for tutorial
Will you make a serialization for the inventory system?
Seems when I instantiate the player it doesnt work. If I drag and drop the player into the scene it works fine. This isnt a huge deal but im wondering if there is a way to do it with instantiate? and yes I drag and drop the correct prefab into the player spot.
Great tutorial as always! Easy to follow and really helped me out except for the fact that it doesn't work. I keep getting this error: Failed to create agent because it is not close enough to the NavMesh. Then whenever I get in range i get this error : "SetDestination" can only be called on an active agent that has been placed on a NavMesh. Anybody know what to do? I already baked the floor and stuff.
@Hadidiz
5 жыл бұрын
i had this problem but when i baked the terrain it worked smoothly
@freeradical9011
2 жыл бұрын
Yes bro I got the same error....
Been watching these videos cause I, when I get a new computer, want to make a first person Dungeon Crawler, similar to Fromsoftware's King's Field games.
Thanks Brackeys, your tutorial is really helpful, understand, and...free. I wish that you can make more tutorial and yeah.I like your tutorial **Hope you can get some money from your videos**. Lol
im getting an error: "SetDestination" can only be called on an active agent that has been placed on a NavMesh. UnityEngine.AI.NavMeshAgent:SetDestination(Vector3) EnemyController:Update() (at Assets/EnemyController.cs:25)
@Floyna
4 жыл бұрын
Bake the map again (Map > Navigation > Bake > Bake) Or put your Enemy more close to the map
@cristianbustillo4760
4 жыл бұрын
@@Floyna thx
@bobdagamer640
3 жыл бұрын
I’ve hit bake and nothing happened
@zzedixx
3 жыл бұрын
@@Floyna where is the "map" tab??
@Floyna
3 жыл бұрын
It's the map you use to move you're character You can locate it on you're Scene Sorry guys i'm late :o The method I gave is not universal but maybe it's work for you
I like that u speak fast and dont waste our time 👊👊👊
Do you have to NavMesh before you do this? Because I tried and my AI wasn't chasing me.
Man you'r the best.
i'm getting a set destination error. it says it can only be called on an active agent that has been placed on the nav mesh.
@paulkruger4156
4 жыл бұрын
You need to add a navmesh surface script too your environment, then back the navmesh
@RakeshKumar-ql3xw
4 жыл бұрын
@@paulkruger4156 how to do that can you tell me
@degamearena9667
4 жыл бұрын
I have the same...
@LucasWithAC
4 жыл бұрын
go to navigations, press bake, and you are done my friend.
@liamschwartz2169
4 жыл бұрын
@@LucasWithAC can you tell me where is navigation please?
can you add npc interaction? (ie. popup windows with conversation/quests)
Sir. NullReferenceException: Object reference not set to an instance of an object Pointing this line of code: float Distance = Vector3.Distance(target.position, transform.position);
Thanks for this tutorial
This is a great tutorial but I got one problem. The Enemy(Which Is a low poly model) chases my backwards so when he is standing whit his face towards me he will turn and chase my like that. This doesn't happen when he punches me. Any tips?
Hi i tried it but it is showing "setdestination can only be called on an active agent that has been placed on a Navmesh"
U are one of the best YT-ers i know and i mean it, keep up the great work my frend :) BTW where did u get Photoshop from? ^^´
@antonijesolarov2113
6 жыл бұрын
This is from rarbg, the site is really reliable and i have never encountered a virus. rarbg2018.org/torrent/r4g5auw7tcohmp1likznf9qe638xjydbv2szs62cpbtfumdve5x8l713rkoqj9aiy4hgnw
Awesome! Yes it is!
Hy, quick question : if there is a wall between the enemy ai and the player, does the ai know to go around the wall or just walks to the wall? Or it has someting like, line of sight when detecting?
@jvcmarc
6 жыл бұрын
for the code that Brackeys showed, the enemy would go around the wall, due to the NavMeshAgent Component (it's a unity comnent that helps when creating Ai), but the wall wouldn't block the line of sight of the enemy, you would have to do some more coding for that as well
@petre1098
6 жыл бұрын
João Vítor Costa Thanks
@ideallyyours
6 жыл бұрын
"Line of sight" can be done using raytracing, although excessive use of this could slow down performance in your game.
Heh I needed A.I. For my game the day before yesterday and (of course) I made it. Too bad I didn't wait another couple of days to get a nice tutorial on it. At least I hope other will find it useful 😊👍
I have a game and this woks great for regular player, but i need it to follow/attack a spawned player prefab how do I do this?
Can i trigger that chase if a raycast hits the enemy .... if so .. then how??? Plz do reply asap
i follow the instructions and it came up with this. "SetDestination" can only be called on an active agent that has been placed on a NavMesh. UnityEngine.AI.NavMeshAgent:SetDestination(Vector3) EnemyAI:Update() (at Assets/EnemyAI.cs:28) ? what does it mean
This is the only video that I've watched that you rushed without explaining much
The type or namespace name 'Interactable' could not be found (are you missing a using directive or an assembly reference?) The type or namespace name 'Interactable' could not be found (are you missing a using directive or an assembly reference?) how can i fix it §?
@amsyarsyahrizal6423
4 жыл бұрын
Sorry I'm a bit late, but to anyone else who has this problem: Make sure to watch this video first --kzread.info/dash/bejne/a6iZstyyfJnKl8Y.html
@firepuppy7211
3 жыл бұрын
i can help u if u still want it
For some reason Unity shows an error when I try to do Enemy : Interactable...is there a way to fix the interactable error here?
@nicpotoplyak8259
3 жыл бұрын
same here did you find a fix?
Got it to work in VR. Add a nav mesh to you PlayerController. Add an empty gameobject to scene and put the PlayerManger script on it. Then add the PlayerController to gameobject you just made in inspector. This needs to be something that moves with you. The XRRig that is parent will be stationary so wont see you move and nav mesh is needed for enemy to see you. Lots of comments but hope mine helps someone
This video help me a lot, thx. I was wondering, can I make the enemy stop more closer to the player?
@PabloBesfamille
4 жыл бұрын
Got it! You have to change the Stopping Distance on the nav Mesh Agent. Hope I help someone :)
I have one problem and it's : NullReferenceException: Object reference not set to an instance of an object EnemyController.Update () (at Assets/Scripts/Controllers/EnemyController.cs:22) can someone help me please ?
@melonmuncher9166
5 жыл бұрын
same
When I do it, it says failed to create agent because there is no NavMesh and it also says SetDestination can be called on an active agent that has been placed on a NavMesh. Help!
I love this series. I don't know how far you want to take it, but topics I would love to see covered are amongst others: - changing scene without losing the inventory and stats etc. - saving and loading the game (maybe even with savepoints like in some JRPGs like Final Fantasy) - trading with NPCs or maybe even have dialogue with different options or even different outcomes - a simple system to level up and customizing stats with each level up - day/night cycle or weather effects I know a lot of these things are probably covered in other videos or you could read up on those topics somewhere online etc. but it would be fun to learn these things in the context of this little RPG series :) Of course this list could be endlessly long haha there's so much you could do! Anyways, keep up the good work :)
can someone help in my unity appears object reference not set to an instance of na objetc .. : s i dont know what to do ...
Can someone help me? i have the same coding as Brackeys has for the enemy AI but it doesn't work. Like it doesn't give me any errors at all but the enemy doesn't move
@thenumberseven1479
2 жыл бұрын
You gotta bake it, see the first comment above. Might be a little late though:)
Hi, i keep getting errors about the enemy scripts saying Interactable. Any fix? Thanks
Is there a way to keep track of how many enemies are attacking the player at a time?
Because of you I create my first "game". Thanks you. Because of it i want to learn English.
@friesandcats1919
3 жыл бұрын
hows english coming along?
Hey!! I'm making this game and want switch camera! Do you have any video were you show how to do that? Great videos, keep it up!!
@MattRynbrand
6 жыл бұрын
Just have a reference to both cameras, and simply enable & disable them as needed.
@Mr.Adhesive
6 жыл бұрын
dextrex Victor you could also just store two positions, and always have the camera at one position. This would probably prevent small lag spikes on the other guys method.
@leptosurreal460
6 жыл бұрын
Store 2 empty gameObject and use transform.Translate. You can also use camera.LookAt with the right range.
@anandkrishna590
6 жыл бұрын
Use Vector3.lerp() instead of transform.Translate().
@leptosurreal460
6 жыл бұрын
Yes! That's a good idea ^^.
We need a "Making an RTS in Unity" :D
If any errors, set floor to static, then go to window > AI > Navigation > and hit bake
I downloaded the zip from github and I tried opening the finished project and it opens but it has a compilation errors. Assets\Environment\PostProcessing\Editor\PropertyDrawers\MinDrawer.cs(6,34): error CS0104: 'MinAttribute' is an ambiguous reference between 'UnityEngine.PostProcessing.MinAttribute' and 'UnityEngine.MinAttribute'. What is this? can anyone help I'm such a noob. I really want to know how to put enemy AI into models!! Please help