- Home /
Can I send a Transform as parameter with BroadcastMessage()?
I have encountered an error (which is stumping me) while trying to use BroadcastMessage() which states:
Failed to call function GotAHit of class CountInAreaMission Calling function GotAHit with no parameters but the function requires 1.
This seems weird as my BroadcastMessage call looks like this:
function SomethingImportantHappened( pos : Transform)
{
BroadcastMessage( "GotAHit", pos , SendMessageOptions.DontRequireReceiver );
}
The called function looks like this:
function GotAHit( ove : Transform )
{
//do super secret stuff w the transform
}
I have successfully sent an int through the same functions without any trouble. So the question is: Can I send a Transform as parameter with BroadcastMessage()? or is BroadcastMessage() only for primitive variables? or am I at fault?
Thanks for any and all replies!
Answer by Eric5h5 · Apr 16, 2010 at 05:06 PM
Probably you're trying to pass a null transform.
Spot on! thanks! Should state so in the compiler error though :D