ENEMY AI - Making an RPG in Unity (E10)

  Рет қаралды 539,410

Brackeys

Brackeys

Күн бұрын

Пікірлер: 840
@yasg5922
@yasg5922 4 жыл бұрын
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
@minecraftmadlad3593 4 жыл бұрын
Thanks so much lol
@TheSecretSause
@TheSecretSause 4 жыл бұрын
ya thank you
@laurisdupois8275
@laurisdupois8275 4 жыл бұрын
Thanks !!
@sealclips7236
@sealclips7236 4 жыл бұрын
Thank you so much!
@dcengiz40
@dcengiz40 4 жыл бұрын
thanks a lot
@LeonardoSilvaHavelock
@LeonardoSilvaHavelock 7 жыл бұрын
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
@James-zr1lu 6 жыл бұрын
Technically it isn't free. The video is monetized by ads. So, it costs you your time.
@AMBafoon
@AMBafoon 6 жыл бұрын
James which is more valuable than money if you think about it
@gorgestboi1028
@gorgestboi1028 5 жыл бұрын
@Big Smoke PINEAPPLE ON PIZZA IS AMAZING
@mainaody3997
@mainaody3997 5 жыл бұрын
@@andrewnagengast2349 the pineapples on pizza part got me lol
@pitanga1724
@pitanga1724 4 жыл бұрын
Mds, achei um BR! Aleluia!!!
@Yonac
@Yonac 5 жыл бұрын
"if we get closer to our enemy, it will start to chase us, *AWESOME* "
@__Rizzler__
@__Rizzler__ 4 жыл бұрын
"Hehe boi u have got some knowledge" - words of an old dog
@s4mcreed314
@s4mcreed314 7 жыл бұрын
My days goes awesome when he says "AWESOME!"
@nirangasithara4925
@nirangasithara4925 3 жыл бұрын
After all these years I still come back to your videos..... Awesome Job my man !!! Mad Respect !!!
@ContinualImprovement
@ContinualImprovement 7 жыл бұрын
Man, I love your videos. Especially these RPG ones 👌
@finanzenkeine
@finanzenkeine 4 жыл бұрын
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
@rhetorical_
@rhetorical_ 7 жыл бұрын
Man, thank you for making these tutorials! They're top notch quality and very interesting! Keep it up!
@dascience1147
@dascience1147 2 жыл бұрын
yes
@dprazo
@dprazo 4 ай бұрын
6 years later and this video is still doing better than most recent videos
@spook2794
@spook2794 4 жыл бұрын
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
@Floyna 4 жыл бұрын
Bake the map again (Map > Navigation > Bake > Bake) Or put your Enemy more close to the map
@cristianbustillo4760
@cristianbustillo4760 4 жыл бұрын
@@Floyna thx
@bobdagamer640
@bobdagamer640 4 жыл бұрын
I’ve hit bake and nothing happened
@zzedixx
@zzedixx 4 жыл бұрын
@@Floyna where is the "map" tab??
@Floyna
@Floyna 4 жыл бұрын
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
@beastninja5655
@beastninja5655 3 жыл бұрын
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
@mosaabmatar4117 3 жыл бұрын
Same here There is no class Named Interactable Its maybe Changed
@codingTheFuture
@codingTheFuture 6 жыл бұрын
Love this series. It's been a great help with my current project. Keep the coming!
@averagehumanbeing7932
@averagehumanbeing7932 3 жыл бұрын
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
@sevendarsh4082 3 жыл бұрын
lol
@codemoor
@codemoor 6 жыл бұрын
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
@amsyarsyahrizal6423 4 жыл бұрын
Sorry I'm a bit late, but to anyone else who has this problem: Make sure to watch this video first --​kzbin.info/www/bejne/b6XIga2vgZuXncU
@firepuppy7211
@firepuppy7211 4 жыл бұрын
i can help u if u still want it
@bluedonnut_8096
@bluedonnut_8096 4 жыл бұрын
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
@_CloudyBunny
@_CloudyBunny 5 жыл бұрын
Let's start to create deep-learning AI enemy.
@thebloocat
@thebloocat 4 жыл бұрын
Yeah! You know any good resources for that?
@arneljansarmiento
@arneljansarmiento 5 жыл бұрын
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
@davidcheung9939
@davidcheung9939 3 жыл бұрын
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
@nicpotoplyak8259 3 жыл бұрын
same here did you find a fix?
@majesticmaniac6420
@majesticmaniac6420 4 жыл бұрын
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
@damienarchaglet8088
@damienarchaglet8088 5 жыл бұрын
i keep getting this 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)
@DrSTew-qt1mm
@DrSTew-qt1mm 5 жыл бұрын
same
@kerlonleite1927
@kerlonleite1927 5 жыл бұрын
Same.. Any solutions ?
@theforgot3n1
@theforgot3n1 5 жыл бұрын
Maybe you NavMeshAgent is inactive? Or you forgot to add the component to the cube?
@arcadeboy7503
@arcadeboy7503 5 жыл бұрын
You go to Window>AI>Navigation and once you have the navigation window open, click on the objects that you want to bake a NavMesh and in the bake tab click bake. Hope this helps!
@pleckton2972
@pleckton2972 4 жыл бұрын
@@arcadeboy7503 Thannkksss
@tssper3488
@tssper3488 4 жыл бұрын
I'm stiil wondering how to 'collapse' when using regions in the c# scripts. I looked up keyboard shortcuts but nothing helps. Somebody pleasre help...
@najeeburrehman3303
@najeeburrehman3303 4 жыл бұрын
there is a - sign in leftside where the region starts click it
@tssper3488
@tssper3488 4 жыл бұрын
Najeeb Ur Rehman Oh ok thanks, helps a lot
@VoltFall
@VoltFall 4 жыл бұрын
@@tssper3488 maybe you should look closer
@parkerhall9470
@parkerhall9470 4 жыл бұрын
it is Control + M + M I think?
@Ecoustic
@Ecoustic 4 жыл бұрын
Lol me too
@tombecker1197
@tombecker1197 4 жыл бұрын
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
@Fishing-vr7eh 3 жыл бұрын
Pry a spelling error
@coolgamingmaster2578
@coolgamingmaster2578 7 жыл бұрын
Can someone help me? I have a problem with the nav mesh agent. I checked my script to be like brackeys' but it don't work. Unity says: SetDestination can only be called on an active agent that has been placed on a NavMesh. UnityEngine.AI.NavMeshAgent:SetDestination(Vector3)
@luisguilherme216
@luisguilherme216 7 жыл бұрын
i have the same problema!! please help !!
@coolgamingmaster2578
@coolgamingmaster2578 7 жыл бұрын
sumerian ozzyz i fixed it. Make a group for the floor and go to window then navigation and its gonna open a bonus window next to the inspector. Then go to objects select mesh renderer and select the floor group(the y axis should be the same) then do this group static - yes for all children and then go back to navigation and bake the floor. Ask if you havent understand
@luisguilherme216
@luisguilherme216 7 жыл бұрын
im trying thanks
@luisguilherme216
@luisguilherme216 7 жыл бұрын
its done but now it appears object reference not set to an instance of na objetc .. : s
@coolgamingmaster2578
@coolgamingmaster2578 7 жыл бұрын
have you dragged it into the inspector (when you create for example public GameObject player you need to drag the object - the player in the inspector)
@SuperPizdolizac
@SuperPizdolizac 7 жыл бұрын
I can't believe how good you are at explaining!
@pedrogll6052
@pedrogll6052 4 жыл бұрын
"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:27) can someone help me?
@monkeyballs188
@monkeyballs188 4 жыл бұрын
generate a navmesh for your floor
@mateodemicheli2420
@mateodemicheli2420 4 жыл бұрын
@@monkeyballs188 How i do that? In my Console apears this : "SetDestination" can only be called on an active agent that has been placed on a NavMesh. UnityEngine.AI.NavMeshAgent:SetDestination(Vector3) AgarrameSiPodes:Update() (at Assets/AgarrameSiPodes.cs:38) Pleas answer the soon as you can :c
@benmohrland
@benmohrland 4 жыл бұрын
I also got this error. I think I fixed it by placing my character on the ground or at least closer to it.
@chosengames4172
@chosengames4172 4 жыл бұрын
@@mateodemicheli2420 Go to the windows tab at the top and find the navigation panel(should be in the AI section). Then click over to the bake tab and bake.
@MycoalD
@MycoalD 4 жыл бұрын
@@chosengames4172 thank you sooooo much
@omnigulwillofcrota8391
@omnigulwillofcrota8391 6 жыл бұрын
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
@Hadidiz 5 жыл бұрын
i had this problem but when i baked the terrain it worked smoothly
@freeradical9011
@freeradical9011 3 жыл бұрын
Yes bro I got the same error....
@valorantworld8895
@valorantworld8895 3 жыл бұрын
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
@breewilkinson8787
@breewilkinson8787 4 жыл бұрын
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?
@scottev954
@scottev954 5 жыл бұрын
Great info on NavMeshes... I was able to get the right information quickly and easily!! Thank you for all of your tutorials.
@anhky2010
@anhky2010 7 жыл бұрын
Thank you so much, Brackeys! I am looking forward to the next part! :D
@BerwinSingh
@BerwinSingh 4 жыл бұрын
I am getting an error "Set Destination" can only be called on an active agent that has been placed on the NavMesh. UnityEngine.AI.NavMesh:SetDestination(Vector3). How to fix this and what is the mistake? Please help me.
@Noir-mt3bw
@Noir-mt3bw 4 жыл бұрын
Berwin Singh i have this too.
@meltpack8876
@meltpack8876 7 жыл бұрын
When everyone makes half hour long ai vids but ya boi asbjørn got ai down
@ateKna
@ateKna 7 жыл бұрын
@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.
@raivologins9299
@raivologins9299 3 жыл бұрын
I like that u speak fast and dont waste our time 👊👊👊
@thatrandomguy8567
@thatrandomguy8567 6 жыл бұрын
I got this error "SetDestination" can only be callrd on an active agent that has been placed onna NavMesh. Any help?
@ashothayrapetyan9828
@ashothayrapetyan9828 5 жыл бұрын
​@@juniorasare9769 Thank you
@overwhelming9212
@overwhelming9212 5 жыл бұрын
@@juniorasare9769 Hey I dont understand this part " open the navigation window, select the floor, go on object and turn on navigation static" could you help me out pls
@Aswll
@Aswll 5 жыл бұрын
@@overwhelming9212 any obstacles or walls you have set it as "Navigation Static" on the inspector (top right corner). In Unity, NavMesh generation is handled from the Navigation window (menu: Window > AI > Navigation). Do the same with the Enemy AI object. I think. Try it and let me know if it worked!
@Aswll
@Aswll 5 жыл бұрын
@@overwhelming9212 also bake them
@Adkinsy85
@Adkinsy85 5 жыл бұрын
@@juniorasare9769 thank you ❤️
@closed9009
@closed9009 5 жыл бұрын
error CS0506: 'Enemy.Interact()': cannot override inherited member 'Interactable.Interact()' because it is not marked virtual, abstract, or override help!
@Corez
@Corez 5 жыл бұрын
Have you made a function for it?
@burpybirb
@burpybirb 5 жыл бұрын
Who else got a little spooked when he suddenly plays the music
@abdelrhmanmagdey334
@abdelrhmanmagdey334 6 жыл бұрын
Can you help me , An error appear says ""SetDestination" can only be called on an active agent that has been placed on a NavMesh"
@gaddgames
@gaddgames 4 жыл бұрын
same
@mr_moon2374
@mr_moon2374 4 жыл бұрын
@@gaddgames you go to the windows tab then head to ai then navigation. go to objects then click on your ground then press navigation static. then go back to the bake tab and hit bake. hope that helps
@loucypatucy5974
@loucypatucy5974 4 жыл бұрын
for me when i write OnDrawGizmosSelected it pops up a warning that the (OnDrawGizmosSelected) is declared but never used pls someone help
@ZaCool26
@ZaCool26 5 жыл бұрын
Can someone help. I keep getting this error: "Failed to create agent because there is no valid NavMesh". I've tried baking it but it still doesn't work! What is wrong???????????
@icoderunity5066
@icoderunity5066 4 жыл бұрын
hello, to make this work you need to set your ground to static(and your obstacles) then bake turn off Auto lightning if still doesn't and set your obstacles in the scene as "Navmesh Obstacles".
@ZaCool26
@ZaCool26 4 жыл бұрын
icoder Unity Thanks 🙏🏻 it works now 😄
@icoderunity5066
@icoderunity5066 4 жыл бұрын
No problem, i had that issue too. :)
@BRboi777
@BRboi777 7 жыл бұрын
Wow what a great channel this is. I've been subbed for sometime and coding interests me. Thanks for the awesome channel! :)
@JShunk
@JShunk 4 жыл бұрын
I’m getting the error “MissingComponentException: There is no ‘NavMeshAgent’ attached you the “Enemy” game object, but script is trying to access it.” Any way to fix this?
@matthewbrown995
@matthewbrown995 4 жыл бұрын
add NavMeshAgent to Enemy if you haven't already
@JShunk
@JShunk 4 жыл бұрын
Got it thanks!
@Sam-dn9lj
@Sam-dn9lj 5 жыл бұрын
I was wondering if anyone could help me on my problem. I have typed in all of the code up to 5:35 and I attempted to run the code and I got this error: "Failed to create agent because there is no valid NavMesh" My player has a NavMeshAgent component on it, so I am not sure what I am doing wrong. Thanks.
@lionn00b
@lionn00b 5 жыл бұрын
@@juniorasare9769 Thank you!! this helped
@adarshs5974
@adarshs5974 6 жыл бұрын
Why is he always Smiling?
@kieranmahon9687
@kieranmahon9687 6 жыл бұрын
Adarsh s because he is happy helping us
@ezpz4646
@ezpz4646 6 жыл бұрын
Adarsh s Lol
@rahultech2177
@rahultech2177 6 жыл бұрын
@@ezpz4646 yak
@Driesipops
@Driesipops 4 жыл бұрын
the sniper would be angry if he didnt
@awesomeskelly2885
@awesomeskelly2885 4 жыл бұрын
it woudnt look good if he was frowning
@Joseph-mt3iw
@Joseph-mt3iw 5 жыл бұрын
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
@melonmuncher9166 5 жыл бұрын
same
@josephkelly3044
@josephkelly3044 6 жыл бұрын
I tried to attempt this but form some reason I keep getting two errors: NullReferenceException: Object reference not set to an instance of an object EnemyController.Start () (at Assets/Scripts/Controllers/EnemyController.cs:15) NullReferenceException: Object reference not set to an instance of an object EnemyController.Update () (at Assets/Scripts/Controllers/EnemyController.cs:22) Anybody have any idea whats wrong?
@trallaton
@trallaton 6 жыл бұрын
You ever figure out what was wrong?
@trallaton
@trallaton 6 жыл бұрын
I have it fixed. Apparently the Awake function just wasn't capitalized.
@trallaton
@trallaton 4 жыл бұрын
@Yaq I got you fam
@patiimusic3701
@patiimusic3701 4 жыл бұрын
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
@oc9438
@oc9438 6 жыл бұрын
just a great tutorial overall, even though I cannot donate currently I will be sure to share your channel as much as possible
@opreaandrei4012
@opreaandrei4012 3 жыл бұрын
any ideea why my enemy is coming exactly into me , i mean after he reaches me he stays exactly where i am ( on top of me ) and i cant move . If i put a rigidbody on him , after he reaches me and i attack him or he just touches me he go away and never come back xD . Any help pls ?
@dron5734
@dron5734 3 жыл бұрын
did you changed "stopping distance" in navMeshAgent component?
@opreaandrei4012
@opreaandrei4012 3 жыл бұрын
@@dron5734 I tried but not working so well
@Greed-ms2cv
@Greed-ms2cv 6 жыл бұрын
Thank you for your videos! But i encounter some problem. It is working. but when i put a new enemy not the first one. there's 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:35) It is the same as the first enemy it have rigidbody, navmesh agent and the scripts that works in the first enemy . somebody help me :3
@1zc5
@1zc5 6 жыл бұрын
I have a script that can help you!!! this script using UnityEngine; using UnityStandardAssets.Characters.FirstPerson; using UnityEngine.AI; public class AiExample : MonoBehaviour { public enum WanderType { Random, Waypoint }; public float damage = 16f; public GameObject fpsc; public WanderType wanderType = WanderType.Random; public float wanderSpeed = 4f; public float chaseSpeed = 7f; public float fov = 120f; private bool isAware = false; private Vector3 wanderPoint; public Transform[] waypoints; private bool Attacking = false; public GameObject radgollZombie; public GameObject NPC; [SerializeField] private float health = 100f; public float viewDistance = 10f; private NavMeshAgent agent; private Renderer renderer; public float wanderRadius = 7f; private int wayPointIndex = 0; private Animator anim; public void Start() { agent = GetComponent(); renderer = GetComponent(); wanderPoint = RandomWanderPoint(); anim = GetComponentInChildren(); } public void Update() { if (isAware) { agent.SetDestination(fpsc.transform.position); anim.SetBool("Aware", true); agent.speed = chaseSpeed; //renderer.material.color = Color.red; } else { SearchForPlayer(); wander(); anim.SetBool("Aware", false); agent.speed = wanderSpeed; //renderer.material.color = Color.green; } } private void OnTriggerEnter(Collider other) { if (hit.GetComponent()) { GetComponent().ApplyDamage(damage); } Attacking = true; anim.SetTrigger("Attack"); } private void OnTriggerExit(Collider other) { Attacking = false; } public void SearchForPlayer() { if (Vector3.Angle(Vector3.forward, transform.InverseTransformPoint(fpsc.transform.position)) < fov / 2f) { if (Vector3.Distance(fpsc.transform.position, transform.position) < viewDistance) { RaycastHit hit; if (Physics.Linecast(transform.position, fpsc.transform.position, out hit, -1)) { if (hit.transform.CompareTag("Player")) { OnAware(); } } } } } public void OnAware() { isAware = true; } public void wander() { if (wanderType == WanderType.Random) { if (Vector3.Distance(transform.position, wanderPoint) < 2.5f) { wanderPoint = RandomWanderPoint(); } else { agent.SetDestination(wanderPoint); } } else { if (waypoints.Length >= 2) { if (Vector3.Distance(waypoints[wayPointIndex].position, transform.position) < 2f) { if (wayPointIndex == waypoints.Length - 1) { wayPointIndex = 0; } else { wayPointIndex++; } } else { agent.SetDestination(waypoints[wayPointIndex].position); } } { Debug.LogWarning("Please Assign more than 1 waypoint to the me!!" + gameObject.name); } } } public Vector3 RandomWanderPoint() { Vector3 randomPoint = (Random.insideUnitSphere * wanderRadius) + transform.position; NavMeshHit navHit; NavMesh.SamplePosition(randomPoint, out navHit, wanderRadius, -1); return new Vector3(navHit.position.x, transform.position.y, navHit.position.z); } public void ApplyDamage(float damage) { health -= damage; if (health
@finlayf5432
@finlayf5432 6 жыл бұрын
@Yaman what should I drag into the NPC ragdoll zombie and Fpsc ? And thanks for the script
@1zc5
@1zc5 6 жыл бұрын
Finlay Fulton drag a prefab that look exactly like the model you are using as a enemy then exclude it from any thing attached to it except the rigid body meaning you need to remove the animator and the Ai script then make it rag doll by right clicking it in the hierchey and press 3D model then press rag doll and assign the bones to it for the fpsc just drag the playable character to it Edit: btw when you make it rag doll and making it as a oregano drag it to the zombie rag doll sorry for calling it zombie but because I was using it for my zombie game
@dong-kunlee5395
@dong-kunlee5395 5 жыл бұрын
Check "navmeshagent.enable = true;:" maybe you have coded disable navmeshagent
@CypriCar
@CypriCar 4 жыл бұрын
i did a project but when i am going to red gizmos unity give me this error : " MissingComponentException: There is no 'NavMeshAgent' attached to the "Enemy" game object, but a script is trying to access it. You probably need to add a NavMeshAgent to the game object "Enemy". Or your script needs to check if the component is attached before using it. UnityEngine.AI.NavMeshAgent.SetDestination (UnityEngine.Vector3 target) (at C:/buildslave/unity/build/artifacts/generated/bindings_old/common/AI/NavMeshAgentBindings.gen.cs:35) Enemy.Update () (at Assets/Codes/Enemy.cs:20) " Could you help me guys
@tdawg6348
@tdawg6348 4 жыл бұрын
ChlodWin did you try adding a NavMesh?
@MLDEDXX
@MLDEDXX 4 жыл бұрын
is there another place I can put the player manager beside the game manager since I only need the ai and not the entire
@ItsCodeRedYT
@ItsCodeRedYT 5 жыл бұрын
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!
@indyt2370
@indyt2370 5 жыл бұрын
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
@thenumberseven1479 3 жыл бұрын
You gotta bake it, see the first comment above. Might be a little late though:)
@sgyffysgyffy4736
@sgyffysgyffy4736 7 жыл бұрын
Great work Brackeys!
@Rejnols
@Rejnols 4 жыл бұрын
Hey there! I'm making AI for a school project. I'm not interested in making the whole RPG, just the AI part. Can anyone tell me why i get an error when i change the public class of the enemy to Interact? I assume it because it was created in a previous episode, but i'm not great with Unity yet so i have no clue how to make that.
@thelegendarymushroom80
@thelegendarymushroom80 Жыл бұрын
:( exactly the same problem here. Did you ever manage to find out about it? I also did not watch previous episodes D:
@thelegendarymushroom80
@thelegendarymushroom80 Жыл бұрын
Decided to speed watch all his episodes until I find the reason, then the second episode hit me haha. It's all in Episode 2.
@Madmanmpu
@Madmanmpu 7 жыл бұрын
For some reason, the enemy is not following or moving when the player comes within the distance. Any ideas?
@Madmanmpu
@Madmanmpu 7 жыл бұрын
Apparently my Enemy object keeps sinking into the ground on start... Seems to be preventing it's movement.
@Madmanmpu
@Madmanmpu 7 жыл бұрын
Ok, apparently I had a few errors. My transform for my graphics was offset, and my capsule collider was to tall/wide. Seems to be operating just fine now.
@Sicho84
@Sicho84 7 жыл бұрын
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 :)
@bearfeeplayz2168
@bearfeeplayz2168 4 жыл бұрын
The name 'agent' does not exist in the current context 3:23 helppp meee
@pinklasagnamemes
@pinklasagnamemes 4 жыл бұрын
on your enemy, do you have Nav Mesh Agent Component? If you don't, you need to press Add Component, and in search bar type: "Agent" or "Nav", i think i explained it.
@bearfeeplayz2168
@bearfeeplayz2168 4 жыл бұрын
Thanks for the help but I just didn't type public NavMeshAgent agent;
@Glubblub
@Glubblub 4 жыл бұрын
something to note is that if its not working, try going into the PlayerManager script and change (GameObject player) into (Transform player).
@shehzaanansari8204
@shehzaanansari8204 7 жыл бұрын
This is amazing bro!
@thomasgamerofhazel2296
@thomasgamerofhazel2296 3 жыл бұрын
u was the best person and u will be on our hurts.
@ferrellfamily6316
@ferrellfamily6316 3 жыл бұрын
Assets\Scripts\Controllers\EnemyController.cs(23,41): error CS1061: 'Transform' does not contain a definition for 'Postion' and no accessible extension method 'Postion' accepting a first argument of type 'Transform' could be found (are you missing a using directive or an assembly reference?) Help ;-;
@ferrellfamily6316
@ferrellfamily6316 3 жыл бұрын
OOOH I JUST REALIZED I MISSPELLED POSITION THATS WHY IT WASN'T WORKING!
@TheJosueWay
@TheJosueWay 3 жыл бұрын
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.
@SquidSilver
@SquidSilver 2 жыл бұрын
Thank you so much, you helped me realize I did that too!
@liamsykes489
@liamsykes489 4 жыл бұрын
dose this tutorial work for other games and not just the one hes making
@braaad2613
@braaad2613 4 жыл бұрын
im making an fps and i can confirm that it works for my ai enemies most of these tutorials can be implemented into and type of game
@liamsykes489
@liamsykes489 4 жыл бұрын
thank you so much this is really helpfull
@ChristianRuppelt
@ChristianRuppelt 7 жыл бұрын
Awesome video as always. Would loooove to see this be converted to a multiplayer / coop.
@Nox__
@Nox__ 4 жыл бұрын
Before brackeys tutorial was a little bit boring like the intro was just "today we are going to make the A.I." Bur now we have a mlittle joke in almost every intro Brackeys really changed in a good way
@mags1205
@mags1205 5 жыл бұрын
Because of you I create my first "game". Thanks you. Because of it i want to learn English.
@friesandcats1919
@friesandcats1919 3 жыл бұрын
hows english coming along?
@joshuaalvinreturban2554
@joshuaalvinreturban2554 6 жыл бұрын
I followed your first code but no wiresphere seen. How to fix this?
@gagemurphy777
@gagemurphy777 4 жыл бұрын
Make sure you have gizmos applied in scene window
@tonysopranodrivingsongslover
@tonysopranodrivingsongslover 6 жыл бұрын
even though I copy everything you do it still doesnt work, "SetDestination" can only be called on an active agent that has been placed on a NavMesh, please someone help me.
@alextronic4503
@alextronic4503 5 жыл бұрын
you will need to bake nav mesh on the ground they are standing on, its been over an year lol ik, i hope you found it
@Psychopsam
@Psychopsam 2 жыл бұрын
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?
@shuxinio
@shuxinio 4 жыл бұрын
Assets\Scripts\EnemyController.cs(6,14): error CS0101: The namespace '' already contains a definition for 'EnemyController' How to fix that? PLS help
@emile14
@emile14 3 жыл бұрын
you probably have two of the same scripts
@petre1098
@petre1098 7 жыл бұрын
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
@jvcmarc 7 жыл бұрын
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
@petre1098 7 жыл бұрын
João Vítor Costa Thanks
@ideallyyours
@ideallyyours 7 жыл бұрын
"Line of sight" can be done using raytracing, although excessive use of this could slow down performance in your game.
@Zukomazi
@Zukomazi 5 жыл бұрын
I followed this tutorial to the T, same scripts exactly but the cube would not move. I took off the rigid body, and it works perfect now. Anyone with same problem , try messing with the rigid body
@markfourth531
@markfourth531 7 жыл бұрын
You're really cool! I love your work. keep up :)
@KEM4OFFICIAL
@KEM4OFFICIAL 6 жыл бұрын
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)
@angusmccall3400
@angusmccall3400 6 жыл бұрын
Don't forget to generate a NavMesh!!!
@VoltFall
@VoltFall 4 жыл бұрын
How you do that?
@MiniKeanuReeves
@MiniKeanuReeves 3 жыл бұрын
For some reason the red circle attack radius never goes away in the scene, is there any way I can get rid of this? It gets really annoying when I'm tryna make other things.
@friesandcats1919
@friesandcats1919 3 жыл бұрын
honestly, just get rid of it from the script then. its not actaully needed, its jsut to help the game devs visuallize how far the enemy attack range is. players arent going to see the wires so why keep them if you dont want them?
@baherarts
@baherarts 3 жыл бұрын
@@friesandcats1919 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.
@vbwebb
@vbwebb 7 жыл бұрын
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
@MattRynbrand 7 жыл бұрын
Just have a reference to both cameras, and simply enable & disable them as needed.
@Mr.Adhesive
@Mr.Adhesive 7 жыл бұрын
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
@leptosurreal460 7 жыл бұрын
Store 2 empty gameObject and use transform.Translate. You can also use camera.LookAt with the right range.
@anandkrishna590
@anandkrishna590 6 жыл бұрын
Use Vector3.lerp() instead of transform.Translate().
@leptosurreal460
@leptosurreal460 6 жыл бұрын
Yes! That's a good idea ^^.
@redarktech
@redarktech 4 жыл бұрын
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
@OLUVUH
@OLUVUH 7 ай бұрын
MY ENEMY GOES THROUGH WAAAAALLLLLLLLLLLLLLLLLLLS
@itsinugami
@itsinugami 3 жыл бұрын
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.
@jaridkeen123
@jaridkeen123 5 жыл бұрын
6:34
@canadianrocketman3475
@canadianrocketman3475 4 жыл бұрын
tyty
@fv4202x
@fv4202x 4 жыл бұрын
oldcommentyoutuber
@IFCreativeAlt
@IFCreativeAlt 3 жыл бұрын
???
@min02-213
@min02-213 5 жыл бұрын
hey how did the GameManager appear?? need help
@samzou6255
@samzou6255 5 жыл бұрын
he made a "create empty" and named it "GameMaster" and put the scripts :)
@Krexalll
@Krexalll 7 жыл бұрын
This is great! I really love your videos!
@lablabs3726
@lablabs3726 5 жыл бұрын
Brackeys you dont have Crafting system video right? i was trying to ... but hard to apply to my inventory its kinda confusing
@ghostdeveloper1833
@ghostdeveloper1833 4 жыл бұрын
NullReferenceException: Object reference not set to an instance of an object EnemyController.Update () (at Assets/Scripts/Controllers/EnemyController.cs:23) anyone know how to fix this one?
@treidex
@treidex 4 жыл бұрын
Same
@tombecker1197
@tombecker1197 4 жыл бұрын
using System.Collections; using System.Collections.Generic; using UnityEngine; public class enemy : Intractable { public override void Intract() { base.Intract(); // Attack the enemy } } what am i doing wrong
@ThiagoSoli
@ThiagoSoli 3 жыл бұрын
Intractable ?
@owenconnolly8627
@owenconnolly8627 2 жыл бұрын
I have the same problem
@TotatoC
@TotatoC 5 жыл бұрын
"We would love to teach you to code a really fun way"
@dascience1147
@dascience1147 2 жыл бұрын
u know what bros? I'm SUSCRIBING TO BRACKEYS LEZ GOOOOO! WOOO HOOOO! YAAAAAAAAA...
@lazyrafay
@lazyrafay 2 жыл бұрын
sadly hes not going to make vdos anymore
@favour5442
@favour5442 4 жыл бұрын
This is the only video that I've watched that you rushed without explaining much
@juliancanery3424
@juliancanery3424 4 жыл бұрын
I'm stuck on Gizmos... when I type it in the editor it doesnt turn orange like in ur tutorial. it just shows up as regular text.
@farhanhakim2189
@farhanhakim2189 4 жыл бұрын
Maybe it doesn't show because you aren't using UnityEditor
@simas8039
@simas8039 2 жыл бұрын
depending on the program it doesn't show as orange text, for example mine is in regular text but works just fine
@ondrejkarbas7287
@ondrejkarbas7287 7 жыл бұрын
Will you also do saving? That's the only part i don't know how to do
@Ownage4lif31
@Ownage4lif31 7 жыл бұрын
Ondřej Karbaš usually you store it in xml and load the data. You see that most games have their own file, id be interested too to see how he does it with unity.
@ondrejkarbas7287
@ondrejkarbas7287 7 жыл бұрын
RandomSilly i know how to do it in simple games (mobile games for example) where you just need to save money, finished levels and stuff like that, but in a gamd where you can save whenever you want it will be much harder
@ondraenglish8131
@ondraenglish8131 7 жыл бұрын
Ondřej Karbaš make game objects from the XML?
@ondrejkarbas7287
@ondrejkarbas7287 7 жыл бұрын
Ondra English i didn't know if there was a more optimised way
@gastonmolina7784
@gastonmolina7784 7 жыл бұрын
You can make a binary .dat file storing your data with a System namespace. Unity has a tutorial for this. Google it, persistance and duration Unity tutorials I guess you will find it that way.
@ImusingX
@ImusingX 5 жыл бұрын
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?
@rodrigo.cs.machado
@rodrigo.cs.machado 5 жыл бұрын
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
@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
@bakatoxo8755
@bakatoxo8755 7 жыл бұрын
Hi there, I've got a doubt: why use that method to keep facing the player instead of using LookAt()?
@RitobanRoyChowdhury
@RitobanRoyChowdhury 7 жыл бұрын
The look at methods just act really weird. I've very rarely been able to make them work the way I want them to. I suspect the problem here is that he doesn't want the enemy to rotate on the x or z axes. Look At doesn't allow that. Its easier to just write some extra code to calculate this by hand than trying to fiddle with the input parameters to get the right results.
@bakatoxo8755
@bakatoxo8755 7 жыл бұрын
I use LookAt(new Vector3(player.transform.position.x, this.transform.position.y, player.transform.position.z)) to avoid rotating in the Y axis. Although I should probably use his method to have more control over what the enemy does.
@RandyS1214
@RandyS1214 7 жыл бұрын
Hey Brackey , for some reason my enemy AI chases me but dosen't stop in front of my player character, instead it pushes it around because its trying to go to the exact transform location of my player. Where could be the problem?
@rahulgarg9080
@rahulgarg9080 7 жыл бұрын
RanTheMan100 ur stopping distance could be set to 0
@RandyS1214
@RandyS1214 7 жыл бұрын
thats what it was i figured it out a few days after my comment, must of missed that part in the video
@radradradrad5113
@radradradrad5113 6 жыл бұрын
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?
@Paul-rd5zk
@Paul-rd5zk 5 жыл бұрын
Severity Code Description Project File Line Suppression State Error CS0246 The type or namespace name 'Interactable' could not be found (are you missing a using directive or an assembly reference?) Assembly-CSharp C:\Users\Jack l\Unity\Game\Assets\000Scripts\Zombie Scripts\Enemy.cs 7 Active
@jacobWhite517
@jacobWhite517 4 жыл бұрын
Paul that most likely means you made referenced a variable/object in the code that doesnt exist, so you either spelled something wrong, or just completely messed up somethings name
@amsyarsyahrizal6423
@amsyarsyahrizal6423 4 жыл бұрын
Sorry I'm a bit late, but to anyone else who has this problem: Make sure to watch this video first -kzbin.info/www/bejne/b6XIga2vgZuXncU
@cheeseydirt84
@cheeseydirt84 4 жыл бұрын
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
@WGUG4
@WGUG4 5 жыл бұрын
can someone please help me For some reason my gizmo isn't apearing and I don't Know if i am doing something wrong or it just don't work anymore if someone can test and tell me if my version of unity is still working I would be grateful I am using unity 2018.3.14f1
@rerwerwqdsdfsdafdsf5006
@rerwerwqdsdfsdafdsf5006 5 жыл бұрын
private void OnDrawGizmosSelected() { Gizmos.color = Color.red; Gizmos.DrawWireSphere(transform.position, LookRadius); } And dont put it in Void update
@WGUG4
@WGUG4 5 жыл бұрын
@@rerwerwqdsdfsdafdsf5006 Thank
COMBAT - Making an RPG in Unity (E11)
12:29
Brackeys
Рет қаралды 316 М.
A.I State Machine Made EASY (Unity)
8:09
Sebastian Graves
Рет қаралды 98 М.
We Attempted The Impossible 😱
00:54
Topper Guild
Рет қаралды 56 МЛН
How to use Unity NavMesh Pathfinding! (Unity Tutorial)
15:25
Code Monkey
Рет қаралды 216 М.
INTEGRATION 01 - Making an RPG in Unity (E03)
7:55
Sebastian Lague
Рет қаралды 347 М.
How to MAKE YOUR GAME LOOK GOOD!
13:02
Brackeys
Рет қаралды 601 М.
3D ENEMY AI in UNITY - (E01): STATE MACHINE BEHAVIORS
17:24
GDTitans
Рет қаралды 56 М.
How to code SMARTER A.I. enemies | Unity Tutorial
32:49
This is GameDev
Рет қаралды 61 М.
STATS - Making an RPG in Unity (E09)
11:43
Brackeys
Рет қаралды 193 М.
2D PATHFINDING - Enemy AI in Unity
23:13
Brackeys
Рет қаралды 827 М.
Creating SMART enemies from scratch! | Devlog
5:40
Challacade
Рет қаралды 370 М.
Make Video Games
44:12
Pirate Software
Рет қаралды 1,4 МЛН
We Attempted The Impossible 😱
00:54
Topper Guild
Рет қаралды 56 МЛН