How can I keep the informations from derived class in Actor::OnHit

what do you mean by “lose the information” when you cast say
Cast<AMyCharacter>(HitResult.GetActor()) you don’t lose things you gain the additional context of the specific class you are now looking at (please keep in mind that you could check that the if(HitResult.GetActor() != nullptr) first)

if you AMyCharacter has a member function TakeDamage() then you would need to cast to the character in order to call that function (unless it is part of the virtual function table then you just need to try and cast high enough to where the function first exists)

if health is a UActorComponent then do you need to cast to the Character in order to call a specific function, couldn’t you just do HitResult.GetActor().GetComponent() (as healthComponent is probably not a USceneComponent you can’t Hit that component to test that)