Hi guys,
I have been reading up on how to send multiple variables with SendMessage. The simplest way that I ‘thought’ I could understand was using was using a struct.
I have this at just above the void Awake() function…
public struct ExplosionParameters
{
public float explosionForce;
public float explosionUpForce;
public Vector3 explosionPosition;
}
I then try to send a message to the other script…
hit.gameObject.SendMessage("ExplosionInfo", new ExplosionParameters{ explosionForce = Force, explosionUpForce = UpForce, explosionPosition = transform.position } );
This has 3 Parameters.
The other script has the following void…
public virtual void ExplosionInfo(float eF, float eUF, Vector3 eP)
{
explosionForce = eF;
explosionUpForce = eUF;
explosionPosition = eP;
}
This also has 3 parameters.
But, I am getting the following error…
Failed to call function ExplosionInfo
of class vp_DamageHandler Calling
function ExplosionInfo with 1
parameter but the function requires 3.
What am I doing wrong?
Many thanks for looking!
Sincerely,
Bruce