Small thing that doesn't really matter but the OnTakeDamage is only killing the unit if the health is less than 0, instead of less than or equal to 0. Thanks for the video!
@LlamAcademy Жыл бұрын
Oops! Great callout. Thank you!
@back2back7122 жыл бұрын
Here to help you!! Yes, You!! (Loved it)
@durvids4742 жыл бұрын
Great video as always! Keep em coming!!
@LlamAcademy2 жыл бұрын
You know it! 😉
@bluzenkk Жыл бұрын
I'm so glad that I purchased the asset Shape to do this world space health bar thingy...
@AlejandroGonzalezGM8 ай бұрын
Would this method be efficient in an RTS with hundreds of units? I've read some concerns about using Unity UI system, and I'm wondering whether that has to do with using several canvases (one for each health bar) and if using just one world space canvas woud also be problematic.
@LlamAcademy8 ай бұрын
When I made this it was definitely more performant than running single item canvases per unit. Depending on the scale of RTS this could be fine. If you have thousands of units you probably need some ECS system instead
@TheJungaBoon2 жыл бұрын
Excellent video as usual!
@LlamAcademy2 жыл бұрын
🙌thank you!
@sunnykwan5630 Жыл бұрын
10:58 the health bar frame is slightly "broken" (instead of having a round rectangle, it become scratchy) in some of the angle, and it doesn't look good. I think it is because the Face Camera script doesnt make the bar rotate perfectly to the screen. What are the possible solutions for that?
@sunnykwan5630 Жыл бұрын
its solved by rotating the canvas instead of the health bar itself
@LlamAcademy Жыл бұрын
great to hear!
@wulfB Жыл бұрын
Which part of the script makes a health bar follow its respective unit? Since the UI object is being parented to the canvas I imagined you'd need an update method somewhere in the unit or health bar, to keep them both on track.
@LlamAcademy Жыл бұрын
You are correct, there is a script on the HealthBar called FollowTarget that, on Update, sets the position to the Target's position + the Offset (see around 9:35)
@wulfB Жыл бұрын
@@LlamAcademy Ah ok thank you! And thanks a lot for these videos, they've been incredibly helpful, especially the ones on navmesh!
@aabb-em6bc2 жыл бұрын
Health bar, quest mark on the head of the NPC, etc I wonder which method is best for these general requirements. This will also be possible with a single screen space overlay canvas. Or Health bar prefab may be owned by all objects as world space canvas. (with multiple world space canvas) Is there any special reason to use the method introduced in this KZbin video? Which method is the most common?
@LlamAcademy2 жыл бұрын
Sorry I don't understand the question. Is the question: is it better to use a single screen space overlay canvas or multiple world space canvases? I would recommend a single World Space, that's what we did in this video. I'm sure other ones would work, but Unity recommends against having a ton of canvases with single elements because each Canvas has some overhead.
@alperaydin70112 жыл бұрын
Very Nice , Thanks
@RogerHNobrega2 жыл бұрын
The progress bar video isn't available anymore? The link in description doesn't work for me.
@LlamAcademy2 жыл бұрын
Weird.. thanks for letting me know! Try this one. I will edit the description as well kzbin.info/www/bejne/h6iboJeCfdtmbrM
@saadblabla2 жыл бұрын
Hey its me again! I just played cod mobile and , not only sound, but also bullet impacts are applied based on texture. How do they do that? Can you do a tutorial on it ?
@LlamAcademy2 жыл бұрын
Hi again! :) I have one that shows how to play a bullet impact based on a Material: kzbin.info/www/bejne/aJOzlZKaotZ6q68 You can use that and mix it with the what you learn in the terrain audio sound playing one (kzbin.info/www/bejne/j4mbdmR3eph1j9U) if you want it to be texture based!
@4ndr3w1431 Жыл бұрын
You spoke too quickly about the single canvas bit... how are the healthbars rendering on a single canvas but all facing different directions?
@LlamAcademy Жыл бұрын
Each health bar is its own Transform, so we can independently rotate those to look at the camera, just like any other Transform component. There's nothing restricting a UI element to be aligned to be perfectly flat on the Canvas!
@Jumph96 Жыл бұрын
Hey, just wanted to preface this by saying that the content you're creating is invaluable, helped me quite a lot. I've tried implementing what you've shown in the video, my only difference is that there's a moving Third person camera attached to my player that moves around the playarea. I noticed however that whenever I move the camera around the sizes of the healthbars change. I think it's tied to the angle at which I'm looking at them from. But I thought that the billboarding script was supposed to address that? I mean, the healthBars do face the camera, but the size keep changing. I don't understand why that is.. ? Cause technically they should always point to my camera and so never change size... Maybe?.. 🤔
@LlamAcademy Жыл бұрын
Hey! Sorry for the delay on getting to this one. Because we're using "world space" health bars, the size of each health bar will be scaled as it gets farther away from the Camera. Just having them face the camera makes it so they are always aligned to be "looking at" the camera so you can always see the full health bar. For non-size changing health bars I think you need to use a ScreenSpace camera and find the position of the object on the canvas and position the object based on that. I think docs.unity3d.com/ScriptReference/Camera.WorldToScreenPoint.html WorldToScreenPoint helps here
@Jumph96 Жыл бұрын
@@LlamAcademy Thanks for the reply I'll look up the Unity API link you sent 👍. Don't know if you saw one of my older replies under one of your videos, but in any case, I just remember mentioning an idea for a possible new video, something like a Quest System would be great (Having it based on NPC Interactions or with quests assigned sequentially by a QuestManager in the scene).
@stalkerkk2 жыл бұрын
Kindly one tutorial on Full body fps ik.
@LlamAcademy2 жыл бұрын
A challenge! I’ll add it to the topic list!
@Wannenbichler2 жыл бұрын
Just wanted to say i really love your content. In the project i'm currently working on i also have similar health bars that are implemented differently, but have the same problem i see here: sometimes the bars from agents that are further away from the camera get drawn on top of others that are closer. This obviously is caused by the child order of the canvas, that ofc does not correlate to the camera distance. I haven't found a solution to this yet...
@LlamAcademy2 жыл бұрын
Thanks I appreciate that! For that problem you can try something like a "Heath Bar Manager" script that manages the sizes and the health bars and the order of the heathbars. For example maybe farther away ones you may want to scale down and closer ones scale up to the size we have in this video. You can keep track of each health bar as they're added to the Health Bar Canvas in a similar way to how we SetUpHealthBar on the Enemy. Then you can check with the Vector3.Distance between each enemy and the camera and order them on the Canvas by that distance.
@Wannenbichler2 жыл бұрын
@@LlamAcademy Thanks for the reply! I am mostly concerned with the ordering, and i just found the methods SetAsFirstSibling,SetAsLastSibling and SetSiblingIndex in the docs. I guess these are what i was looking for, and i can use them for ordering by distance as you said.
@LlamAcademy2 жыл бұрын
@@Wannenbichler awesome!
@obscureskeleton Жыл бұрын
Just a heads up for anyone experiencing this issue in the future, adding a small plane behind the health bar (depending on the bar's shape) also works. Make sure it's a child of the health bar and only just slightly behind it, and the player shouldn't be able to see it as they rotate around it. You can also make it the colour of whatever your health bar backing is and replace that with it.
@sim-card86852 жыл бұрын
My question is where do we initialize our ProgressBar Healthbar?
@LlamAcademy2 жыл бұрын
Sorry, I don't think I understand the question? What do you mean by initialize the progress bar?
@sim-card86852 жыл бұрын
@@LlamAcademy I think the progressbar is default set to "null" so we should get a nullreference exception. But you don't get that. So it was set to a value before. But where have you done that? Have you used GetComponent?
@LlamAcademy2 жыл бұрын
Oh. I assigned it in the inspector
@sim-card86852 жыл бұрын
@@LlamAcademy Thanks. I have not seen that you marked it as public or [SerializeField]
@sim-card86852 жыл бұрын
@@LlamAcademy Ohhh now i see... i was confused because the attribute is on top of it thanks
@XifYz10 ай бұрын
I love how he never shows nor explains the script that makes the health bars actually "follow" units.
@LlamAcademy10 ай бұрын
Hmm... I thought I did towards the end. If not, you can see it here: github.com/llamacademy/worldspace-health-bars/blob/main/Assets/Scripts/FollowTarget.cs it's a very simple script on Update just setting the position to the target positon + some offset.
@marcamooo2 жыл бұрын
why am i early?
@LlamAcademy2 жыл бұрын
Sorry what do you mean?
@marcamooo2 жыл бұрын
@@LlamAcademy idk im just like never early
@Akhazy08 ай бұрын
you make the most confusing video tbh
@LlamAcademy8 ай бұрын
👍
@bensalter79972 жыл бұрын
Sorry for what I did.
@xticxs4656 Жыл бұрын
this is the first time ive disliked a video because why do i have to watch 3 other videos just do this one
@LlamAcademy Жыл бұрын
Sorry you feel that you had to watch several other videos. In the first few seconds of the video I set expectations that this video would be focused on the health bar following the target, not implementing explosions, AI spawning and wandering, and implementing a progress bar. That video would be closer to an hour and most people would be skipping 90% looking for what I tried to focus the video on. The full project for all of my videos are always on GitHub, so you can review the project on your own computer at your own pace after the guided tutorial video.