I’ve got a simple situation, if a character goes X units from the map origin I want them to execute the same logic they would if they hit the kill z.
To do this I figured I’d just call the same function that gets called: FellOutOfWorld.
But FellOutOfWorld wants a const UDamageType& and I had a very frustrating time trying to get one.
Eventually the best I could figure out was this:
if (GetActorLocation().Size() >= KillDistance)
{
FellOutOfWorld(*TSubclassOf<UDamageType>(UDamageType::StaticClass()).GetDefaultObject());
}
And that just feels so wrong, but it works. So my question is, is this the way we are intended to use UDamageType? Surely there is a more sensible way to get an instance of a damage type.