What does this line of code mean? What does this "Static Class mean? Why we need this? Do I need to use this?
This Health Component is custom made and not built in. I made it.
Need step by step explanation.
Thank You
What does this line of code mean? What does this "Static Class mean? Why we need this? Do I need to use this?
This Health Component is custom made and not built in. I made it.
Need step by step explanation.
Thank You
Does this help?
Ok. That was about static class but what about the rest of the line of code. I need explanation for the line of code in the photo.
GetComponentByClass
returns a UActorComponent*
and you presumably want to use the returned component as the type you’re looking for. You wouldn’t be able to access any of the members of it without the cast.
P.S. That code can be simplified to
UHealthComponent* HealthComp = TestPawn->FindComponentByClass<UHealthComponent>();
And it does the casting for you. This may help you understand casting, only focus on lines 25 onwards.
This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.