How do I properly use UDamageType?

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)

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.

If you look at the FellOutOfWorld Function of the Actor.cpp you will see that the UDamgeType parameter is not used at all.

You can call those lines that are in the FellOutOfWorld Function


Or you do the same that KillZVolume or Actor does


Or even simpler


UDamgeType has no state so its fine.

Ah yes, this is precisely what I was looking for. I did not know of this GetDefault function, this is what I wanted.