Тёмный

ENEMY AI - Making an RPG in Unity (E10) 

Brackeys
Подписаться 1,8 млн
Просмотров 537 тыс.
50% 1

Опубликовано:

 

2 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 839   
@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__ 3 года назад
"Hehe boi u have got some knowledge" - words of an old dog
@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
@dprazo
@dprazo Месяц назад
6 years later and this video is still doing better than most recent videos
@ContinualImprovement
@ContinualImprovement 7 лет назад
Man, I love your videos. Especially these RPG ones 👌
@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
@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
@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 2 года назад
lol
@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
@s4mcreed314
@s4mcreed314 7 лет назад
My days goes awesome when he says "AWESOME!"
@meltpack8876
@meltpack8876 7 лет назад
When everyone makes half hour long ai vids but ya boi asbjørn got ai down
@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?
@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
@justyourdailyreminder6800
@justyourdailyreminder6800 5 лет назад
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
@paulkruger4156 5 лет назад
You need to add a navmesh surface script too your environment, then back the navmesh
@RakeshKumar-ql3xw
@RakeshKumar-ql3xw 5 лет назад
@@paulkruger4156 how to do that can you tell me
@degamearena9667
@degamearena9667 4 года назад
I have the same...
@LucasWithAC
@LucasWithAC 4 года назад
go to navigations, press bake, and you are done my friend.
@liamschwartz2169
@liamschwartz2169 4 года назад
@@LucasWithAC can you tell me where is navigation please?
@adarshs5974
@adarshs5974 6 лет назад
Why is he always Smiling?
@kieranmahon9687
@kieranmahon9687 5 лет назад
Adarsh s because he is happy helping us
@ezpz4646
@ezpz4646 5 лет назад
Adarsh s Lol
@rahultech2177
@rahultech2177 5 лет назад
@@ezpz4646 yak
@Driesipops
@Driesipops 4 года назад
the sniper would be angry if he didnt
@awesomeskelly2885
@awesomeskelly2885 4 года назад
it woudnt look good if he was frowning
@sgyffysgyffy4736
@sgyffysgyffy4736 7 лет назад
Great work Brackeys!
@SuperPizdolizac
@SuperPizdolizac 6 лет назад
I can't believe how good you are at explaining!
@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....
@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
@Thomas-wd8zm
@Thomas-wd8zm 7 лет назад
Make a build system
@codemoor
@codemoor 5 лет назад
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 --​ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-9tePzyL6dgc.html
@firepuppy7211
@firepuppy7211 4 года назад
i can help u if u still want it
@anhky2010
@anhky2010 7 лет назад
Thank you so much, Brackeys! I am looking forward to the next part! :D
@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
@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 6 лет назад
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 ^^.
@jaridkeen123
@jaridkeen123 5 лет назад
6:34
@canadianrocketman3475
@canadianrocketman3475 4 года назад
tyty
@fv4202x
@fv4202x 4 года назад
oldcommentyoutuber
@IFCreativeAlt
@IFCreativeAlt 3 года назад
???
@rikbanerjee3888
@rikbanerjee3888 5 лет назад
public Transform Player; Can't you just do this in update: transform.LookAt(Player); transform.translate(0,0,5 * time.deltatime);
@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?
@filiplayz1893
@filiplayz1893 4 года назад
Im getting "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:28) please someone help
@cast01
@cast01 4 года назад
window - AI - navigation - then select the floor u have go to bake and bake it - then go to object and select the floor u baked and check navigation static and generate offmeshlinks. I was having this problem too.
@lucasdacosta5243
@lucasdacosta5243 4 года назад
@@cast01 thank you so much this worked!! 😁
@filiplayz1893
@filiplayz1893 4 года назад
Fen1x_ I didn’t set the object to static that’s why it wasn’t working. Thanks for the help tho
@dagohlin1555
@dagohlin1555 4 года назад
@@cast01 thank you it worked for me to
@nils9586
@nils9586 4 года назад
@@cast01 Thanks very much.
@angusmccall3400
@angusmccall3400 6 лет назад
Don't forget to generate a NavMesh!!!
@VoltFall
@VoltFall 4 года назад
How you do that?
@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 -ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-9tePzyL6dgc.html
@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
@TotatoC
@TotatoC 5 лет назад
"We would love to teach you to code a really fun way"
@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?
@markfourth531
@markfourth531 7 лет назад
You're really cool! I love your work. keep up :)
@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
@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
@Pentasoniczound
@Pentasoniczound 5 лет назад
Punching you in the face, is easier than you think. (Stupid commercial).
@ateKna
@ateKna 6 лет назад
@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.
@capnhotdog5789
@capnhotdog5789 3 года назад
the dislikes are all the people who forgot to put ";" at the end of the lines of code
@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.
@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
@bex2quik
@bex2quik 3 года назад
it wont let me derive enemy from interactable pls help!
@friesandcats1919
@friesandcats1919 3 года назад
i have the same problem did you ever fix it? i cant change monobehaviour to Interact able, did you ever find out how to fix it?
@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
@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
@nirangasithara4925
@nirangasithara4925 3 года назад
After all these years I still come back to your videos..... Awesome Job my man !!! Mad Respect !!!
@yuantu1453
@yuantu1453 4 года назад
Love this channel!!!
@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
@THETCDCStudios
@THETCDCStudios 3 года назад
can you make this with playmaker
@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?
@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 5 лет назад
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 5 лет назад
@Yaman what should I drag into the NPC ragdoll zombie and Fpsc ? And thanks for the script
@1zc5
@1zc5 5 лет назад
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
@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.
@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
@pinhoug
@pinhoug 4 года назад
I have 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:27) Can someone help me?
@jaysbeat5034
@jaysbeat5034 4 года назад
1º)In your scene click on a mesh or train and then in Window tabs select navigation... Now u can see navigation layout beside the inspector... Just in bake tab of navigation click the bottom button that says Bake... And you're done If you have already done this and the problem persists: 2) probably the point where your gameobject is being instantiated outside the reach area of ??the mesh (terrain or plane or quad). Change the position of the spaw point into the area of ??the mesh.experiment by putting this spaw point in the center of the terrain to see. I hope I have helped!
@talibalasrar
@talibalasrar 4 года назад
@@jaysbeat5034 Didn't work
@mr_moon2374
@mr_moon2374 4 года назад
@@talibalasrar ok so go to the window tab then head to ai then navigation. click on the object tab and set it to navigation static then make it walkable. then try baking. hope that helps
@risingmermo
@risingmermo 4 года назад
@@mr_moon2374 I got stuck on this as well and try doing what you wrote but it doesn't work. At the start it says "Failed to create agent because there is no valid NavMesh" I don't understand what's wrong? Can you help?
@risingmermo
@risingmermo 4 года назад
@@mr_moon2374 nvm mind I got it working
@Some-One4
@Some-One4 2 года назад
how did u collapse it the code ?
@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
@ZaCool26
@ZaCool26 4 года назад
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. :)
@Samkruso
@Samkruso 2 года назад
Awesome tutorials you are a great teacher! :D But i did something wrong, my enemy keeps pushing me away. xD
@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
@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 4 года назад
Maybe you NavMeshAgent is inactive? Or you forgot to add the component to the cube?
@arcadeboy7503
@arcadeboy7503 4 года назад
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
@OLUVUH
@OLUVUH 4 месяца назад
MY ENEMY GOES THROUGH WAAAAALLLLLLLLLLLLLLLLLLLS
@muhammadobaidurrehman2156
@muhammadobaidurrehman2156 6 лет назад
Best tutorial dude, thanks
@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).
@ManeCSGO
@ManeCSGO 4 года назад
6:30 really scared me and idk why
@tigogojarek
@tigogojarek 4 года назад
I started scrolling the tabs to see which one is playing the audio
@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
@knowlife500
@knowlife500 4 года назад
i cant find Gizmos while scripting any one can help me?
@burpybirb
@burpybirb 5 лет назад
Who else got a little spooked when he suddenly plays the music
@coolgamingmaster2578
@coolgamingmaster2578 6 лет назад
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 6 лет назад
i have the same problema!! please help !!
@coolgamingmaster2578
@coolgamingmaster2578 6 лет назад
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 6 лет назад
im trying thanks
@luisguilherme216
@luisguilherme216 6 лет назад
its done but now it appears object reference not set to an instance of na objetc .. : s
@coolgamingmaster2578
@coolgamingmaster2578 6 лет назад
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)
@EarlyEditz185
@EarlyEditz185 Год назад
I couldn't add navmeshagent at the start, it didn't show up from 'navigation > navmeshagent' and searching didn't work
@fifthy
@fifthy 2 года назад
how did the simpleton collapse burh
@LushPop
@LushPop Год назад
If anyone just so happens to have the issue where their player wont focus on the enemy, remember to remove the boxcollider from the enemy GFX
@hamandswizz
@hamandswizz Год назад
5 years later and the community still coming through
@LushPop
@LushPop Год назад
@@hamandswizz yup!!
@devonmeekflips2635
@devonmeekflips2635 5 лет назад
no matter the tag my enemy will not move dont know what to do
@extrano_desesperado
@extrano_desesperado 5 лет назад
mine too
@Delvarn
@Delvarn 4 года назад
Mine won't move either!
@roguedagger1
@roguedagger1 4 года назад
PLEASE HELP: It says Object reference not set to instance of an object and it doesn't follow my player even though I baked the NavMesh on the map and everything. I'm trying to add it into a FPS zombie game.
@henkdemetsenaere1374
@henkdemetsenaere1374 4 года назад
Rogue Dagger it should work but can you give me the exact error word for word.
@roguedagger1
@roguedagger1 4 года назад
thanks for helping but i figured it out
@gundistudio
@gundistudio 4 года назад
@@roguedagger1 How did you fix it? I got the same problem
@roguedagger1
@roguedagger1 4 года назад
Hmmmm... I'm pretty sure it was something simple and a dumb mistake like I accidentally took of the navmesh or something. also make sure you dragged it onto that script spot on your character. If you can't figure it out still what I would do is just try to remake your enemy. That might sound daunting but you will be suprised how fast it goes the second time and it will look better. Good luck!
@gundistudio
@gundistudio 4 года назад
I actually found the mistake, but thanks still for helping!
@min02-213
@min02-213 5 лет назад
hey how did the GameManager appear?? need help
@samzou6255
@samzou6255 4 года назад
he made a "create empty" and named it "GameMaster" and put the scripts :)
@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
@mags1205
@mags1205 4 года назад
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?
@averagemelon_
@averagemelon_ 4 года назад
𝗜 𝗚𝗼𝘁 𝗔𝗻 𝗘𝗿𝗿𝗼𝗿 𝗦𝗮𝘆𝗶𝗻𝗴 𝗖𝗦𝟬𝟭𝟭𝟳 𝗤𝘂𝗮𝘁𝗲𝗿𝗻𝗶𝗼𝗻 𝗗𝗼𝗲𝘀 𝗡𝗼𝘁 𝗖𝗼𝗻𝘁𝗮𝗶𝗻 𝗔 𝗗𝗲𝗳𝗶𝗻𝗶𝘁𝗶𝗼𝗻 𝗙𝗼𝗿 '𝗹𝗼𝗼𝗸𝗥𝗼𝘁𝗮𝘁𝗶𝗼𝗻' 𝗣𝗟𝗭 𝗛𝗘𝗟𝗣!
@MagecraftLP
@MagecraftLP 7 лет назад
We need a "Making an RTS in Unity" :D
@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
@DarkTemplar42
@DarkTemplar42 2 года назад
keep get a "Set desintion error" I click bake and it does not work
@gabaihype
@gabaihype Месяц назад
does not work. ive tried baking the plain, where it would move the enemy and it is still giving me some destination erros. bad tutorial in my opinion UPDATE: i've founded a solution that should work to this date. if you go to your terrain model (where you can move your player), and add a new component called Nav Mesh Surface, and click on the bake button it should work!
@AemVR
@AemVR 3 года назад
Failed to create agent because there is no valid navmesh
@deepakchouhan3372
@deepakchouhan3372 4 года назад
i want to create array of players in PlayerManager script...but when i do.....some transform error is showing in enemy script......anybody know why?
@makoopay5250
@makoopay5250 3 года назад
does anyone knows the github of this project?
@JERRYEDITS123
@JERRYEDITS123 4 года назад
Failed to create agent because there is no valid NavMesh what the heck is this??
@edvstudios5926
@edvstudios5926 4 года назад
Same
@saik7241
@saik7241 5 лет назад
this guy is Unity Jesus.
@thenetanel1996
@thenetanel1996 6 лет назад
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
@rezaka116
@rezaka116 6 лет назад
Coding your own games is easier than you think.
@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.
@inukithesavage828
@inukithesavage828 11 месяцев назад
.....why not just make a cube with a capsule collider? Or leave it as a capsule?
@kovidkhokar298
@kovidkhokar298 3 года назад
This is the first Brackeys video that was helpful for me others were just a waste of time. Sorry Brackeys FANS. Edit:-The thing I thought that was helpful was not helpful at all.
@PineLimeCordial
@PineLimeCordial Год назад
Only on line one of the script and it’s already not working for me, it’s like I’m cursed It won’t come up with the red sphere lookRdius thing it just keeps saying “an object reference is required for the non-static field, method, or property “Transform.position” 😭😭😭😭
@notfunny3684
@notfunny3684 Год назад
NullReferenceException: Object reference not set to an instance of an object EnemyController.Update () I am getting this error in enemyController
@bearfeeplayz2168
@bearfeeplayz2168 3 года назад
The name 'agent' does not exist in the current context 3:23 helppp meee
@pinklasagnamemes
@pinklasagnamemes 3 года назад
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 3 года назад
Thanks for the help but I just didn't type public NavMeshAgent agent;
@hamismad123
@hamismad123 Год назад
Does anyone esle's code say "Failed to creat agent because there is no NavMesh"??? Because I've been stuck on it for an hour!
@Saleca
@Saleca 4 года назад
much love, i am still waiting for a link to donations, i dont want to use patron and your link for brakeys.com/donate aint working! (maybe a paypall link??)
@most_likely_sein
@most_likely_sein 2 года назад
help pls the enimy is falling int the ground still chasing me but in the ground
@arneljansarmiento5788
@arneljansarmiento5788 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
@shadowgodthegamer5738
@shadowgodthegamer5738 2 года назад
How do i increase the speed of the enemy?
@aubinjaskierny896
@aubinjaskierny896 Год назад
when I first did this I was scared seeing a t posing dummy start floating towards me
Далее
MOVEMENT - Making an RPG in Unity (E01)
17:11
Просмотров 1,2 млн
How to MAKE YOUR GAME LOOK GOOD!
13:02
Просмотров 595 тыс.
🛑самое главное в жизни!
00:11
Просмотров 220 тыс.
How to code SMARTER A.I. enemies | Unity Tutorial
32:49
Creating SMART enemies from scratch! | Devlog
5:40
Просмотров 333 тыс.
choosing a game engine is easy, actually
15:08
Просмотров 506 тыс.
Minecraft's New Horror Features are Already Here
9:58
Просмотров 141 тыс.
Why Solo Developers Should Use Unreal
9:51
Просмотров 388 тыс.
How to make a HEALTH BAR in Unity!
21:06
Просмотров 1,1 млн
4 Godot 4 Devs Make 4 Games in 44 Hours
25:19
Просмотров 524 тыс.
How to make The Best First Person Camera in Unity
9:04
3D ENEMY AI in UNITY - (E01): STATE MACHINE BEHAVIORS
17:24