Monster shadow

VIDEO

Unity Gizmos - Man in a hat educates you

Description:
Learn what a gizmo is and how to use them effectively. Gizmos are a fantastic help to you in development. Setup indicators for raycasts, map confines, grid positions, etc. It's among the first thing I do when creating a new scene. ========= 🔔 SUBSCRIBE: https://bit.ly/3eqG1Z6 🗨️ DISCORD: https://discord.gg/GqeHHnhHpz ✅ MORE TUTORIALS: https://www.youtube.com/tarodev
ADD A COMMENT

eXca1iburN
I really appreciate that you tackle more advanced stuff than other unity channels, and still manage to explain things quickly and clearly This content is what helps take people from tutorial based projects (no shade at anyone still at that level, we all have to start somewhere) to really understanding the environment, to get the best out of it, and put it back into their projects Thank you =)
Larry D
Your bézier pronunciation was pretty good.
Tarodev
Was it? yes! I was totally expecting to get blasted off my chair
Andreas
All the things I want to learn about you do small videos on. Get out of my head!
Tarodev
I'm here for you 😊
Juan Ignacio Lanosa
looking forward to the next video great content!
Lukas M
With how many small tips and tricks you have, I am really really interested in some of your extension methods/helpful functions class if you have some!!! Thanks so much. Love these vids!
Tarodev
Great video idea
Mandy Lee
Awesome video Taro, I love the 🧢
Allen Halsted
Appreciate that you cover topics that are interesting and useful even to veteran developers.
Bravo
Your programming is absolutely clean and the grid trick (like what the other comment said) is amazing. I didn't even know stuff like random point inside unit sphere, this is mind blowing lol
Tarodev
Learned so many things! That's what I like to hear 😊
DarKos
I thought gizmos were only displayed on edit mode, but it seems they also work on play... Do they still show in build? I thought they were just for debugging and this kind of stuff
Roq M0Z
You can press the gizmos button at the top of the screen in play mode to show during gameplay, but only in editor. It doesn’t get called in a build
Patrik Bergsten
Good video! Looking forward to the Handles video!
ToxicPenguin
Excellent video! I'm really looking forward to the part 2 you mentioned, because I always knew gizmos had capability for more functionality, but I have no idea how to access it.
Gabriel Bigardi
Thanks for the video, waiting for the handles tutorial, i'm trying to make a tool that uses it but im having a hard time.
Alifarhad Ali
great
justcallmedoggie
Noice
ala slipknot
My man has switched to Rider \m/ To anyone still not using it, if you can afford the license, DO NOT HESITATE to give it a try, it will change your coding-life
Stuart Heath
It's also free for students :)
Hamed babamohamadi
Was waiting for an intro! Nice hat btw :) Welldone.
श्री Sojotaku
Noice
Ziplaw
It'd be cool if you made a video about Handles now :)
Tarodev
I'll handle you in a minute
Ziplaw
Be careful with setting x,y or z to 0 on non-wire cube gizmos! I've had it happen where they appear black when I needed to be of come color, I just needed to set them to .0001, instead of 0
Ziplaw
@Tarodev might be a version specific bug in my case, but yeah I usually avoid both negatives and 0 for those
Tarodev
Possibly an AA issue? To be honest I always set them to 0.1 for years, then one day I randomly tried it and it worked!
Joschino
Great video, never really thought to draw a grid with wireframe cubes but that makes it so much easier.
SEE ALL COMMENTS


Transcript:

hello lovelies so today i want to show you uh gizmos so i use gizmos
extensively uh and basically they're just little visual indications on your
scene view and your game view if you want that kind of just help you in your
development cycle and just an example of uh gizmos that you've seen a million
times if you create a light you'll see this little gizmo here
which is just shown in the same view but if you wanted to actually show in the
game view as well you can press the gizmos button here you can also press
the gizmos button here on your same view and hide it there let's get stuck in so
i'm just going to open my intro script here now
whenever you want to play with gizmos all you have to do is hook into the on
draw gizmos and in here let's draw our first gizmo
so gizmos draw sphere and it's asking for two things where we
want to put it in our radius so let's just say we'll put it at world point
zero and radius let's say 0.5 so we'll head back to unity
and now you can see we've got a gizmo there at zero zero
beautiful we can also take advantage of
our wire variants and we'll put our other one at one
so now we should have two spheres one wire and one solid
there we go beautiful
you can also change their colors so we'll just do gizmos color equals uh
let's say red and as you can see they're red now these
are redrawn every single frame so uh i'll just demonstrate that i'll make
a for loop and we'll do like 10 and in here we will do
color is equal to random color
and we'll take a sphere here and draw this and we will draw it at random
inside unit sphere times 5 or something and we'll make the uh
radius of this one five just kind of like the the sphere is a bounding box
and now if we try this out you'll see that they are ten new spheres
are being drawn every second uh every frame then just destroyed and then drawn
again so that that kind of shows you that it is being redrawn every single
frame and uh gizmo is a very performance so we
could probably add two zeros on this and it would be absolutely fine
yep getting a little bit of hectic we could probably actually add another zero
on that puppy let's try that probably start lagging a little bit now
yeah getting a little bit chunky but as you
can see it is very performant so you don't have to worry about your gizmos in
your scene i'm sure you're not going to be having 10 000 gizmos so uh another
thing you can do i'll just comment that out another thing you can do is when
you're raycasting something in your game have you ever had uh the experience
where it's like the raycast just doesn't seem to work or like it's not hitting
something that you expect it to be hitting well you can make your job a
little bit easier by saying draw ray uh and then you can simulate the raycast
that you're actually trying to do so let's just say we're starting at zero
this might be your character and you might be like shooting it forward or
something but let's just uh say we're uh we're wanting to shoot ray to one right
like we're gonna shoot one one one so now in our scene view we can see that
it is uh drawing the ray itself now when you're actually doing a ray you'll have
a distance field where you can say i want a distance of 10 but for us you
just you know you just multiply your direction by that
and this will now shoot 10 units okay so that's not too exciting so let's
move on uh this is my grounder so when you
uh have a character and you want to jump you only want them to be able to jump
when they're on the on the actual ground right so when i press spacebar my little
dude will kind of just do a little flip and uh land back down so as you can see
down here i've got a little gizmo at its feet and what's that what that is doing
is it's indicating where my grounder effect is is taking place so if we just
go into the grander script here uh you'll see that when i press spacebar
i'm only allowed to jump if i'm grounded and my grounded getter here is just
doing an overlap sphere a physics overlap sphere uh
at a certain position with a certain radius and if it detects the ground then
it returns yes we are in fact grounded
so to make this easy on me i want to know exactly where this is actually
taking place so on my on draw gizmos here i'm drawing a y sphere at that
exact position with that exact radius and uh it's just easy for me to know
that it's right there because you may be doing your overlap sphere and you have
no idea like your ground offset might be like here or something and you're you're
trying to jump and it's just not working so with all the correct uh gizmos in
place uh the visual aids you know exactly what's happening and uh you
won't get caught out okay so the next one is my favorite uh so in grid uh you
might be creating a grid right with a width and a depth and when you press
play all your uh grid squares spawn but in
when you're not playing you have no idea where that is so like you can't do
anything with this scene right you're like you don't know what's going on uh
so i draw gizmos uh for the shape of my grid which will
obviously change chop and change depending on how big my grid's going to
be so then when i press play the grid is exactly where it needs to be
and i can build stuff around this scene or what have you uh so that's very easy
to do instead of just uh grabbing your grid points in generate grid i'll just
pull them out till i can evaluate grid's grid points function so now i can use
those grid points in both on draw gizmos and generate grid right i just iterate
over the points and draw a draw a wire cube by the way you can put y
as zero and it will just create a nice flat square for you
um and also i'm just checking if we're playing and if we are i just won't draw
those gizmos or else when we press play the gizmos will be drawn on top of these
and it looks a little bit uh chaotic and the last one is uh i just know that
people in the comments are going to tell me that i say this wrong but bezier
curve that's how i've always said it i'm sorry
uh sorry this is uh i wrote a really quick and dirty bezier
algorithm it's horrible please don't judge me on it it was just to
demonstrate uh the different gizmos so here i've got
gizmos for anchors and or command points if you want to call on
that and resolution points there and also the connections so i can like up
update my uh resolution and it will change the resolution and then i can uh
grab these and just move them around so just a
typical bezier curve so it's made up of a few uh gizmo components so here we're
setting yellow and then i'm drawing my spheres for my uh resolution points
there and then here i'm saying uh green
and i'm drawing lines so it gives me a draw line and that is just it's
basically like a ray but instead of giving it a starting and a direction you
give it a start and an end so i'm actually drawing it in between
these points here and it's easier to see if we lower the resolution you'll see
it's just straight lines like that so that's gizmo's draw line very very
easy and and very handy uh and then i'm changing it to red and
then drawing more stuff so as you can see the colors are hierarchical like
you'll see whatever you set your color every gizmo that your drawer is going to
be that color until you change the color uh all the obviously the next scene
comes around and then it all resets again
so that's all i wanted to show you uh this is the basics of gizmos i've got
another one planned where i'm going to show uh like handles and stuff and stuff
that you can actually use and manipulate in the same view
and also text so until then i hope you enjoyed it hope you learned something
subscribe if you haven't and i'll see you in the next video bye
you