How to Add a Field of View for Your Enemies [Unity Tutorial]

Enemies usually have eyes, right? So lets give your enemies some vision! In this video we're going to add a really simple but really effective field of view, field of vision, cone of view, line of sight... Whatever you want to call it, to your enemies!
We're also going to make sure that the enemies can't see you through walls and AS A BONUS! We're going to create an Editor utility so we can see the field of view bounds in the scene view!
Download the scripts here: github.com/Comp3interactive/F...
Join me and learn your way through the Unity Game Engine, the C# language and the Visual Studio editor. Remember, if this video was useful then DROP A LIKE! 👍
💯 Want to help me out and allow me to keep making these tutorials? Consider supporting the channel on Patreon:
/ comp3interactive
😍 AWESOME high quality 3D game assets available here:
shop.runemarkstudio.com/?ref=...
🤩 SPONSORED LINKS:
www.gigatank3000.com
/ gigatank3000
💬 Join the Discord community here:
/ discord
📱 Find us on social media for more Tips and Tricks:
/ comp3interactive
/ comp3interactive
/ comp3int
📱 Play our games for FREE here on Google Play:
bit.ly/2TisAQo #UnityTutorial #Unity3D #Comp3interactive #GameDev

Пікірлер: 218

  • @its_just_matt
    @its_just_matt3 жыл бұрын

    This tutorial has the best thumbnail I've ever seen.

  • @Demented_Chaos
    @Demented_Chaos Жыл бұрын

    Man's out here saving my project with expert guidance, and now I know at least five new things about Unity and C#.

  • @Ophelos
    @Ophelos3 жыл бұрын

    Nothing like a little bit of trigonometry programming in the middle of a friday afternoon. Thanks for the video.

  • @comp3interactive

    @comp3interactive

    3 жыл бұрын

    Did I mention I hate maths... 😂

  • @revoxmediaHD

    @revoxmediaHD

    2 жыл бұрын

    @@comp3interactive luckily for you it wasn’t your maths or code but Sebastian Leagues

  • @hi-its-matt

    @hi-its-matt

    Жыл бұрын

    @@revoxmediaHD wdym, did he copy code?

  • @revoxmediaHD

    @revoxmediaHD

    Жыл бұрын

    @@hi-its-matt Copied it exactly

  • @adriatical9016

    @adriatical9016

    Жыл бұрын

    woah, it's friday afternoon for me

  • @thebeeshu771
    @thebeeshu771 Жыл бұрын

    This is a 10/10 tutorial. It's not the simplest thing to make, but everything is so well explained and the editor script is the cherry on top of the cake.

  • @its_Wooddy
    @its_Wooddy2 жыл бұрын

    Thank you so much for this tutorial! Really cool use of the gizmos for the FOV and very well communicated!

  • @washynator
    @washynator3 жыл бұрын

    Awesome video and clear explanation! Thanks man!

  • @paulberry3359
    @paulberry33593 жыл бұрын

    Really enjoyed this tutorial, simple and powerful and Modular! Since doing your fps tutorial really motivated me to try other things and see what I can put together !

  • @TwistdRabbit
    @TwistdRabbit2 жыл бұрын

    DUDE!!! I am making a VR fps with my 11y/o son as a summer project between college and Uni and you just saved me weeks of stress!!

  • @lukastomasek8038
    @lukastomasek80383 жыл бұрын

    Great tutorial ! I would like to see more videos on custom editors for sure .

  • @welcomelittlefellow
    @welcomelittlefellow2 жыл бұрын

    Just what I was looking for, thank you very much. Clear explanation!

  • @unityvictor787
    @unityvictor7873 жыл бұрын

    Thanks for tutorial, Very simple to understand!!

  • @aussieraver7182
    @aussieraver71822 жыл бұрын

    This is beautiful! Thanks for the tutorial!

  • @ANGELB3AR
    @ANGELB3AR Жыл бұрын

    Fantastic tutorial :) I'll definitely be checking out your other videos for more content like this

  • @imeldaweijers3284
    @imeldaweijers3284 Жыл бұрын

    Just what I needed, thank you so much for this little gem.

  • @overcookedwalrus4482
    @overcookedwalrus4482 Жыл бұрын

    Amazing video! Thankyou for holding our hands through this!

  • @AJMarraffa
    @AJMarraffa2 жыл бұрын

    Excellent tutorial, thank you! It was very easy to integrate into the code I had already written.

  • @genofelice6034
    @genofelice6034 Жыл бұрын

    Thanks. This was the most useful tutorial I've watched in a long time.

  • @Dosterczuk1321
    @Dosterczuk1321 Жыл бұрын

    AMAZING! Thank you for sharing it! Works perfectly good!

  • @chimz8057
    @chimz8057 Жыл бұрын

    Awesome script my man! Thank you!

  • @AdamBarkerThe
    @AdamBarkerThe Жыл бұрын

    Excited for your game next week!

  • @jeffreydotson4842
    @jeffreydotson48422 жыл бұрын

    My kind of tutorial! Clear and to the point without excessive stammering and/or over explaining.

  • @agnarzb
    @agnarzb2 жыл бұрын

    Great tutorial. Very clean and to the point explanation. Would like to add that even it is not main concern of the video but I love the idea to add the editor part as well. Cheers.

  • @JimmyJohansson-pj1zx
    @JimmyJohansson-pj1zx2 ай бұрын

    Good programming tutorials are rare, so whenever I find videos like this I appreciate it a lot.

  • @HarrenTonderen
    @HarrenTonderen3 ай бұрын

    Much thanks, been struggling to find something like this ❤

  • @DanielGarcia-ze9vy
    @DanielGarcia-ze9vy2 жыл бұрын

    Actually the best tutorial on enemy AI I have ever seen so far! I've been wondering so long for help on making raycast detection, thanks a lot!

  • @bakedpizza4037

    @bakedpizza4037

    2 жыл бұрын

    I am new to unity ... I am bit confused where to tell the enemy to do chase player or run any command on detection... Pls tell if you know

  • @azrhyga
    @azrhyga Жыл бұрын

    Thanks very much for making this tutorial!! It is really helpful!! Thanks to this tutorial my enemies now have a field of view so they can detect the player more naturally :D

  • @netanelkomm5636
    @netanelkomm56367 ай бұрын

    Works like a charm, thank you!

  • @DTNenforcer
    @DTNenforcer Жыл бұрын

    Very well explained. Thank you very much for an excellent tutorial.

  • @camelChase20
    @camelChase203 жыл бұрын

    This was perfect and immediately applicable for my AI controllers, thank you for posting!

  • @miikajuhala6748
    @miikajuhala6748 Жыл бұрын

    Thank you so much for nice and clear video!

  • @Folghan
    @Folghan Жыл бұрын

    Exactly what I was looking for. Great job man, I've tried everything and couldn't make it work, and your video saved me from seppuku.

  • @ASeggsyPotat
    @ASeggsyPotat2 жыл бұрын

    It took me a minute to get everything working, but this was exactly what I was looking for! Now I just need to combine this with a few other tutorials (Making the enemy walk around, making the enemy walk towards the player etc) and I'll have the logic for my very first game done! Thanks a billion!

  • @Rize-TheArtOfPlay

    @Rize-TheArtOfPlay

    Жыл бұрын

    Same. Combining the scripts is giong to be the hardest part I guess. Hope you had success!

  • @nugraha000
    @nugraha000 Жыл бұрын

    thank yu so much, u help me a lot bro. keep it up.👍👍

  • @Bobster536
    @Bobster536 Жыл бұрын

    I get so drawn into your voice, that i forget that im watching this tutorial to actually learn and just sit through till the end... Getting through one of yours to the point where id be satisfied enough with understanding the concepts took me ~6 rewatches. Great content my man love you

  • @unDeadGod69
    @unDeadGod692 ай бұрын

    Really helpfull tutorial, thanks for uploading it

  • @user-pp5lp8jy2l
    @user-pp5lp8jy2l4 ай бұрын

    Hi. This tutorial is really fantastic thanks!

  • @muriilouwu
    @muriilouwu2 ай бұрын

    Thank you for the video, I used this logic to implement an aim system in my game :)

  • @pro100baobab
    @pro100baobab4 ай бұрын

    Good job! Thanks!

  • @mrnickhox
    @mrnickhox2 жыл бұрын

    Saved my live thank you so much.

  • @krakuwdegustacja
    @krakuwdegustacja2 жыл бұрын

    best tutorial on enemy fov i've found

  • @olcaval
    @olcaval2 жыл бұрын

    Thank you so much! You explained it perfectly. Now my enemy AI is finnaly working.

  • @jehdiaizon
    @jehdiaizon2 жыл бұрын

    amazing! thank you!

  • @coloneljcd6041
    @coloneljcd6041 Жыл бұрын

    Great vid! Liked and subbed

  • @hewston1
    @hewston13 жыл бұрын

    excellent, thank you

  • @Mikelica69
    @Mikelica692 жыл бұрын

    Thanks a lot ! 🙏🙏

  • @corneliusbuckley8897
    @corneliusbuckley88972 жыл бұрын

    Thanks for doing the maths for me! Such a simple yet super useful tutorial, I appreciate your work.

  • @comp3interactive

    @comp3interactive

    2 жыл бұрын

    And thank you for calling it "maths" and not "math" 😂

  • @saintpatronum921
    @saintpatronum92110 ай бұрын

    good job man!

  • @mindergamestudios
    @mindergamestudios11 ай бұрын

    I'm glad i found your channel.

  • @carpe.die.m
    @carpe.die.m2 жыл бұрын

    MULTIPLE TARGETS CHECK Hi, I don't know if this is 100% correct but it is just my explanation of what was suggested in the video for detecting multiple targets. "FieldOfView" script: 1) Start( ) method: delete/comment out the "playerRef = GameObject.FindGameObjectWithTag("Player");" line -----> this reference is used just in the Editor script for drawing the Gizmo line but doesn't actually have to do anything with the detection of the target. 2) in the FieldOfViewCheck( ) function , as the author said in the video 8:32, the rangeChecks array holds anything that has the targetMask on it and was detected in the radius around your player/character. Then we get one of these detected targets from this array and calculate in what direction this target is and finaly in the if statement with the Vector3.Angle, we calculate if it is in our FOV angle (if it is in the see distance, was automatically calculated by putting targets in our radius in the rangeChecks array). -----> So, here we just have to check this for each of the detected targets in the rangeCheck array. 3) Create a for loop looping through all rangeCheck elements -----> after "if(rangeChecks.Length != 0)" and before "Transform target = rangeChecks[0].transform;". So, we can look at each element in rangeChecks and find out if we see it or not 4) Change "Transform target = rangeChecks[0].transform;" to "Transform target = rangeChecks[i].transform;" -----> So, we are able to calculate stuff for every element in the rangeChecks one-by-one 5) Inside the if statement where we set "canSeePlayer = true", assign the detected target gameObject from rangeChecks to our "playerRef" by adding "playerRef = rangeChecks[i].gameObject;" -----> So, we know we see a player/target/enemy and in the Editor script we can draw the gizmo line 6) add "break;" under assigning the playerRef gameObject -----> this should stop the for loop calculating stuff for the remaining found targets in the rangeCheck[], because we found (at least) one player/enemy/target that we can see. But this doesn't have much impact since it breaks just this one for loop and the next time this method will be called in the coroutine this for loop will run again. Also, this has to be there if you are going to do the remaining steps! 7) Inside the if statements where we set "canSeePlayer = false" write "playerRef = null" there (even to the very bottom else "if(rangeChecks.Length != 0){ }else{...here...}") -----> making sure PlayerRef doesn't hold any gameObject that we don't see anymore. So, the gizmo line is not drawn if there is no player/target/enemy in our sight. Please, read the coments to this (if there are any), maybe I made a mistake or didn't explain something in the correct way. Hope this helps and thank you for the great video, it has significantly improved my project and I learned a lot.

  • @ImFrantic

    @ImFrantic

    2 жыл бұрын

    Hey, your example worked fine. One thing I had to change was: after the *for loop* to check our objects we can no longer say -"Transform target = rangeChecks[i].transform"- since "i" can't leave the for loop. Instead we have to just do *"Transform target = playerRef"* since it was already changed in the forr lopp it's possible.

  • @ImFrantic

    @ImFrantic

    2 жыл бұрын

    In my Case *"playerRef"* is *"enemyUnits"* but anyways here's the finished code: void FieldOfViewCheck() { Collider[] rangeChecks = Physics.OverlapSphere(transform.position, visionRadius, targetMask); if (rangeChecks.Length != 0) { for (int i = 0; i

  • @12edcorea54
    @12edcorea5411 ай бұрын

    very nice guide!

  • @raphaelrtf
    @raphaelrtf3 жыл бұрын

    OMG! You saved me! Thank you so much!

  • @comp3interactive

    @comp3interactive

    3 жыл бұрын

    I got you bro 😉

  • @Vasquez2701
    @Vasquez27012 жыл бұрын

    Thank you very much! Saludos desde Guatemala.

  • @andreamansi2441
    @andreamansi24412 жыл бұрын

    Damn, thanks, you saved me A LOT of time to build a decent AI visual detection algorithm for my university assignment. Clean and elegant implementation, easy to use (actually it cost me around 2 minutes ahah). Simple but powerful script! You should actually sell it, not joking. Thanks!

  • @piyushdamania2087
    @piyushdamania20873 жыл бұрын

    Thanks a ton !

  • @pixvee341
    @pixvee3413 жыл бұрын

    Thanks you're AWESOME :)

  • @kyrollosaziz7519
    @kyrollosaziz75192 жыл бұрын

    absolutely need videos on custom editor tools with, it would be very useful to watch tutorials with such important topic in your great and simple explanation way.

  • @QuantumChord
    @QuantumChord Жыл бұрын

    Thank you for the tutorial, this should help me with designing enemy AI.

  • @parvane8608
    @parvane86082 жыл бұрын

    Amazing Thank you

  • @kitsunedotexe3587
    @kitsunedotexe35872 жыл бұрын

    currently using this tutorial for a really strange mechanic xD haha thanks!

  • @TheKr0ckeR
    @TheKr0ckeR2 жыл бұрын

    Thanks! It was really helpful! Both for Editors and raycasting! I would love to see Custom Editor scripts in the future! Is there anyway to visualize this angles in game too? So that its like a flashlight of enemies. :)

  • @AliceMonUnitydeveloper
    @AliceMonUnitydeveloper2 жыл бұрын

    Thanks!

  • @dopplegangerdavid
    @dopplegangerdavid2 жыл бұрын

    Thanks for the info, Sean Connery.

  • @ImFrantic
    @ImFrantic2 жыл бұрын

    If anybody wants to know how to deal with multiple objects, here it is ( *in my case "playerRef" is "enemyUnits"* ): void FieldOfViewCheck() { Collider[] rangeChecks = Physics.OverlapSphere(transform.position, visionRadius, targetMask); if (rangeChecks.Length != 0) { for (int i = 0; i

  • @ImFrantic

    @ImFrantic

    2 жыл бұрын

    @@Shadowjones You're very welcome mate ^^ That's the reason I posted this here. Enjoy :D

  • @whitedragon44

    @whitedragon44

    2 жыл бұрын

    @@ImFrantic Really thank for this but I have one error. Cant use i++ in this line. for (int i = 0; i

  • @ImFrantic

    @ImFrantic

    2 жыл бұрын

    @@whitedragon44 is your rangeChecks an array? If it's not "Collider[] rangeChecks" it can't work because there is nothing to count.

  • @whitedragon44

    @whitedragon44

    2 жыл бұрын

    @@ImFrantic Collider[] rangeChecks = Physics.OverlapSphere(transform.position, radius, targetMask); You mean this?

  • @kioka2

    @kioka2

    Жыл бұрын

    Thanks! How do I detect the closest object among all those detected?

  • @lukdev
    @lukdev11 ай бұрын

    GOLDEN!

  • @flipthebird6355
    @flipthebird63552 жыл бұрын

    Thanks you

  • @kioka2
    @kioka22 жыл бұрын

    Very good, I learned a lot from your video, thanks for clarifying how to create a FOV! I have a doubt.. how to detect multiple players within the FOV and choose the closest player?

  • @slowman8385
    @slowman83853 жыл бұрын

    Awesome video!!! Can u make a video about enemy hearing range?

  • @comp3interactive

    @comp3interactive

    3 жыл бұрын

    Dude, it's already on my to do list! 😂 Now I just need to find a celebrity with weird ears for the thumbnail 🤔

  • @troyna77
    @troyna77 Жыл бұрын

    This tutorial is better than some unity store assets. why ? 2 reasons: 1)you get to know the "nuts and bolts" of exactly what is going on. 2) and you get the code explained. With a little bit of tweaking, I added my own shooting component and basic health system components. Still trying to figure out how to represent the "fov" during runtime. but thanks !!!

  • @AlexandreFPS_
    @AlexandreFPS_3 жыл бұрын

    Helo! I have a problem, I have a bot script already done (shoot and run) but I put the field of view of your video and it didn't work, I use the Nav Mesh Agent to follow the player, I wanted the bot to stay put and if the player stayed within his field of vision, he shoots, can you help me? I thank!

  • @javednoman3051
    @javednoman30512 жыл бұрын

    nice work, how to use it in case enemy is above or some ledge, and it can see player down or up, i short a 3d cone type field of view mechanic

  • @kitsunedotexe3587
    @kitsunedotexe35872 жыл бұрын

    yessssssssssssssssssssssssssssssssss editor tutorial ♥.♥

  • @patorino5295
    @patorino529510 ай бұрын

    Thanks for the awesome tutorial. I followed your coding, and I noticed something. Should it be transform.forward in the angle check?

  • @halivudestevez2
    @halivudestevez2 Жыл бұрын

    Pretty advaced style tutorial. Just a bit of idea: at fov check, you can avoid the "else" hell spaghetti, if you set the canSee to false 8n the beginning and set again to true at positive check.

  • @nulltensor
    @nulltensor3 жыл бұрын

    Excellent tutorial. Very clear and well communicated. One minor nitpick though: "euler" is pronounced "oil er" rather the "you ler". It's a reference to the Swiss mathematician Leonhard Euler of Euler Identity fame.

  • @comp3interactive

    @comp3interactive

    3 жыл бұрын

    Ah that's interesting, I'll be honest, didn't know that was the pronunciation (obviously). You-ler is pretty well engrained into me now so that might be a hard habit to break 😂

  • @rudefatty1766

    @rudefatty1766

    10 ай бұрын

    🤓🤓🤓

  • @lucasmattos5727
    @lucasmattos5727 Жыл бұрын

    Any way to have a solid color in the radius FOV?

  • @brianjirvin
    @brianjirvin Жыл бұрын

    So followed this tutorial and works mostly, however the distance before player becomes unseen is roughly double the radius

  • @berdikopgroudli1234
    @berdikopgroudli1234 Жыл бұрын

    Hello! I have an AI programmed using this raycast and some path script. The AI works great, but im wondering. Would it be possible to add a searchtime, so when the enemy spots you, and then looses you, he will still go after for lets say 3 seconds? Because when my enemy spots you, and then you hide, he instantly switches to his coded path I have made. Thus making the game really easy(you lose if he catches you) I have tried to add an Ienumerator, but that didnt work.

  • @davidbarnaba7229
    @davidbarnaba7229 Жыл бұрын

    I Ecounterred an issue. I'm using the code on a 2D game, just a couple of differences (vector2 insted of 3 and transform.right instead of forward). When the player is really close to the enemy (with pov) but still in the cone of view, canSeePlayer become false. Can anyone help please?

  • @lerryotter1750
    @lerryotter1750 Жыл бұрын

    I have a problem converting this Script from 2d to 3d, i changed Vector 3 to 2 and forward to right burt it is still on the wrong axis...

  • @IvBallestero
    @IvBallestero Жыл бұрын

    I have an issue, sometimes the script detects the player and sometimes not, plus I had to comment the Editor Script part where player is spotted, as the Handles.DrawLine gives me an error that says: You're pushing more GUIClips than you're popping. Any solution or anyone that has the same problem?

  • @viledeg2569
    @viledeg25692 жыл бұрын

    Nice tutorial, but i wonder how to implement player detection that would work if any part of the player comes in view? Right now it's just detecting if the center of the player is in line of sight but in reality i think a more advanced approach may be needed when the enemy reacts even if only a part of the player is visible.

  • @leventeberes3829

    @leventeberes3829

    2 жыл бұрын

    I guess you could detect colliders

  • @SystembolagetOfficial
    @SystembolagetOfficial2 жыл бұрын

    Ive encountered a problem with this script that doesnt seem to have an clear answer. Whenever my enemy looses sight of my player it just stops and starts to shake in different directions. Like it doesnt seem to find the exact spot my player was on. Another thing is that the enemies path-find perfectly to my player while playing the game in the Unity Editor, but as soon as i export a build of the game, the enemies just kinda randomly decide where to go once the player has been spotted. They dont run off tho, they just kinda waddle around the player.

  • @trentonweber4729
    @trentonweber47292 жыл бұрын

    How would you convert this to 2D?

  • @endxrseeker5051
    @endxrseeker50513 жыл бұрын

    My ai can still see me through walls, it shows the green line going through the walls. I have correctly labled and assigned the correct layer titles. Pls help

  • @elric7371
    @elric73712 жыл бұрын

    Good tutorial. Noticed an bug, when the player is slight above the enemies fov radius (still in the angle). It cannot detect player.

  • @SetharofEdgarDead-Rose

    @SetharofEdgarDead-Rose

    2 жыл бұрын

    needs to add Verticle element to this, or this only works on a flat ground game! Otherwise, this is an Ace Tutorial!

  • @somustache

    @somustache

    2 жыл бұрын

    It's probably because the radius is spherical and not circular for vertical movement. idk

  • @welcomelittlefellow

    @welcomelittlefellow

    2 жыл бұрын

    For future reference, you could try to set the y value on the transform.position and rangechecks[0].transform in the FieldOfViewCheck to make sure that the ray triggered higher above the ground (make sure to create new vector3 objects when doing that as you do not want to manipulate the gameobject transform, only for the check).

  • @giacomociaramella6908
    @giacomociaramella690811 ай бұрын

    Does the physics have better performance over the mesh filter method?

  • @twelveminusone
    @twelveminusone2 жыл бұрын

    I really appreciate the video, this is exactly what I'm looking for! However, I may be dense, but I cannot figure out how to alter the direction of the FOV angle without rotating the game object. In my 2.5d game I've locked rotation and only let objects face left or right. Any guidance would be greatly appreciated!

  • @twelveminusone

    @twelveminusone

    2 жыл бұрын

    Answered my own questions! Just manually replace the eulerY value to whatever you want it to be. I added a "float viewAngle" that's clamped to 0,360 just like viewAngle and can manipulate it however I need it to be. Thanks again for the vid!

  • @wortwortwort117
    @wortwortwort117 Жыл бұрын

    How exactly can this be tweaked for multiple targets... 8:23 You mention adding a for loop but im unsure of how. I've added a for loop to determine the closest collider from the list of all colliders in range, but it will still only seek one regardless of if its visible. If i have 2 targets the enemy will lock onto the closest targe5 even if its behind a wall. The 2nd target can be entirely visible but will be ignored.

  • @MrBanana12344
    @MrBanana123443 жыл бұрын

    You could also just have the player layer and when you are doing the raycast you could type ~targetMask to see if there's anything that's not on the players layer in front of it. The ~ makes Unity check everything but that layer(s)

  • @comp3interactive

    @comp3interactive

    3 жыл бұрын

    100%, but then trouble arises when you have transparent objects like windows which you want the player to be visible through, or meshes with solid colliders but visible gaps, this way you can select multiple layers on the obstructionMask variable to cater for multiple obstruction layers/objects

  • @MrBanana12344

    @MrBanana12344

    3 жыл бұрын

    @@comp3interactive didn't even think of that, thanks for pointing it out

  • @comp3interactive

    @comp3interactive

    3 жыл бұрын

    Nah man it's always good to question methods, I could have made a point of that in the video tbh

  • @Bobster536
    @Bobster536 Жыл бұрын

    I know its bit silly when just copying the code, but ive messed something up and was spending like 10 minutes looking at this one file of code and some settings, only after forfeiting and going back to your video i realised i had everything setup perfectly, just didnt start the coroutine

  • @Bobster536
    @Bobster536 Жыл бұрын

    If i didnt know of your FOVRoutine() solution, I would use a function inside of MonoBehaviour::Update(), and make the function start with a if(bool) which gets set to false for x frames after function does its job. Your solution seems just much more clear, if im getting it right.

  • @Bobster536
    @Bobster536 Жыл бұрын

    I was nearing the end of this tutorial and my player object is invisible on scene view, I didnt click the eye icon to make it so... big mess i could only assume some part of the scripts i wrote before messes up and modifies my player object transform to make it lose visibility or make it small to the point where i cannot see it, still great tutorial

  • @KalOnYoutube69
    @KalOnYoutube692 жыл бұрын

    Hi! Would anyone have any idea how to implement this into a solution where it would go check the players last known location when out of sight? I've tried a few different ways but i can't quite wrap my head around it...

  • @pablosuarez9211

    @pablosuarez9211

    Жыл бұрын

    every frame that the enemy sees the player, set some sort of variable to their position, then when they leave make the enemy go to that position, as it should be the place where the player last was before leaving

  • @dertobbe1176
    @dertobbe11764 ай бұрын

    Neat

  • @schizoscope8703
    @schizoscope87034 ай бұрын

    It's detect position of collider but not collider itself. How can I change the script to fix it?

  • @BF-sl5uj
    @BF-sl5uj8 ай бұрын

    I keep getting "The name 'angleInDegrees' does not exist in the current context" for the FieldOfViewEditor script. Is anyone else running into this problem? I'm using Unity 2021.3

  • @valzzu
    @valzzu Жыл бұрын

    This works perfectly expect if my enemy is higher than the player, can anybody help?

  • @tuseroni6085
    @tuseroni6085 Жыл бұрын

    what's the point of the playerRef?

  • @rakyb12
    @rakyb12 Жыл бұрын

    Hey, can this be applied to 2D??

  • @user-qg1kd4zi3g
    @user-qg1kd4zi3g2 жыл бұрын

    I don't see the green line even though the bool canSeePlayer is enabled.