Overloaded functions fail to call

I am testing new damage functions which will allow headshots and explosion knockback etc, by using multiple versions of the damage function with different parameters, so not all damaging items have to find all the parameters if it’s not needed, and so they can use SendMessage instead of directly calling a function.

I am testing it with this code:

function Damage () {
print("damage, no parameters");
}

function Damage (damage : float) {
print("damage, amount given: "+damage+" no other info");
}

function Damage (damage : float,type : DamageType){
var typeName="Unknown";
if(type==DamageType.RayBullet)
typeName="Raycast Weapon";
if(type==DamageType.RealBullet)
typeName="Bullet Weapon";
if(type==DamageType.Melee)
typeName="Melee";
if(type==DamageType.Explosive)
typeName="Explosive";
if(type==DamageType.Collide)
typeName="Collision";
if(type==DamageType.Splatter)
typeName="Splatter";
if(type==DamageType.Guardians)
typeName="Guardians";
print("damage, amount and type :"+damage+", "+typeName);
}

function Damage (damage : float,type : DamageType,hitCollider : Collider){
var typeName="Unknown";
if(type==DamageType.RayBullet)
typeName="Raycast Weapon";
if(type==DamageType.RealBullet)
typeName="Bullet Weapon";
if(type==DamageType.Melee)
typeName="Melee";
if(type==DamageType.Explosive)
typeName="Explosive";
if(type==DamageType.Collide)
typeName="Collision";
if(type==DamageType.Splatter)
typeName="Splatter";
if(type==DamageType.Guardians)
typeName="Guardians";
print("you just recieved "+typeName+" damage on "+hitCollider.ToString()+". You took this much damage: "+damage);
}

but when using a SendMessage that sends a float damage amount, the no paramteter version is called, and it returns this error: “Failed to call function Damage of class PlayerRigidController
Calling function Damage with 1 parameter but the function requires 3.”
The two parameter version seems to work though, so I don’t know what is going on.

Please could someone help me fix this?

It seems SendMessage does not support overloads. There are some other questions, e.g. here related to this issue.

As a solution, you could create a method with one parameter, a class or struct with three properties - Damage, Type, HitCollider.