I was looking through the HUD etc and I like some of the widgets in use - can someone explain how I can find / navigate to code that directly (for example) updates the health bar - I tried using refernces etc and I get lost - I am new to unreal but not sw development so its more “how can I find out how they did that?” but I dont know how to go deeper into it, if that makes sense?
I believe that the Lyra Shooter Game is mostly made in c++, You can find that in the plugin folder of your Project. And find the weapon class and see how they applied damage to update the health bar
*edit if you cant find an function for it in blueprints you have to go into the c++ code an change it to BlueprintReadWrite
Using the reference viewer is on the right track. Another tool I like to use when ‘untangling’ these things is ‘Tools → Find in Blueprints’ that will allow you to search function names to see where/how they’re being used.
Zondyz does bring up a good point about C++ though, I think what you’ll find is that as you go up the hierarchy you’ll reach a point where the parent is a C++ class.
Since you mentioned you’re new to Unreal, Lyra is a bit like jumping in at the deep end. (But certainly worth poking at these systems)
Welcome to the forums!
Thanks for the warm welcome guys, and great information - I am going to try and attack it from the weapon damage side and then Find in Blueprints.
Ideally I want to take that health bar graphics etc as a widget, and move it accross to my own game - hence trying to see how they turn the static image into a working health bar is what I am trying to pick apart!
I will keep you posted!
No, I am lost
Looking at the damage apply they are using an ability or something as a health holder. Any tips welcome guys?!?
The must exist a BP or C++ function that is saying UpdateHeatlthBarWEidget(float health) type of thing?
So this is the result of me banging my head against the keyboard in an attempt to grok the healthbar.
(This is in the level blueprint of a new level) (It’s still fundamentally flawed as it only takes the health from 100 down to 95)
It sure is cool how it animates though (Indicating damage dealt in yellow and then shrinking)
Ultimately, my recommendation is to watch 10 youtube videos on ‘how to make a healthbar’ and then re-approach lyra. Also, Right-clicking on an asset and ‘Asset Actions → Migrate’ might be a good step in getting this healthbar into a new project. (and onto a clean operating table so to speak)
Thanks guys the video was also extremely helpful!
I tired migrating river to my game - it ports all the materials etc etc but the actual; UAsset doesent show in the content drawer, despite it being in the folder structure on HDD.
If I try and manually import it it says UASSET is an unkown file type? Any ideas?
If you want to see what I mean (I am using UE 5.0.2) - W_Healthbar is the main asset (search W_health in content in Lyra) then if you Migrate it to another project, it pulls everything, materials etc. If you checkl the folder of the new game you can see W_Healthbar.UASSET in the folder structure but its not in the content drawer (anywhere) of the new project (the rest of the marietls etc are,)
This is unexpected, because W_Healthbar is a basic ‘Userwidget’ class. I migrated it to another project and got the same results.
So this is a bug?
W_Healthbar asset updates its own health. There is no code that calls it or updates it.
Content/UI/Hud/W_Healthbar and take a look at its Event Graph.
When the Healthbar constructs, it hooks into the Player Controller’s
OnPossessedPawnChanged event, and then immediately calls the
OnPossessedPawnChanged event with the current pawn.
In that event, it registers itself to receive
OnHealthChanged events from the Pawn’s Health Component.
From then on, any time the pawn’s health changes, the widget automatically updates itself.
When the player dies and respawns, the health widget automatically re-registers itself on the new pawn’s Health Component.