I have a Character (derived from ACharacter) and I attached a HealthComponent (derived from UActorComponent) to it to keep track
of the Character health.
Now I have a Pickup (derived from AActor) that adds health points and I call a Heal() method like this:
On line 22 I get a reference to the HealthComponent of the Character to then call Heal() on line 30:
Now I read that “FindComponentByClass<>()” is an expensive thing to do. But what would be an alternative? How else
can I get a reference from my Pickup AActor to a UActorComponent of a ACharacter?
If I leave out line 22 the engine crashes when I overlap the Pickup with my Character.
Thank you, Peter