- Home /
'sendMessage' is not a member of 'unityengine.transform'
pragma strict
var Dammage : int = 30; var Distance : float;
function Update () { if (Input.GetButtonDown("Fire1") ) { var hit : RaycastHit; if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.foward), hit) ) { Distance = hit.distance; hit.transform.sendMessage("ApplyDammage", Dammage, SendMessageOptions.DontRequireReceiver) ; } } }
Can someone help me please?
Answer by Jeff-Kesselman · May 31, 2014 at 05:22 PM
Its SendMessage
Note the case.
Case is significant in most programming languages.
you also spelled forward wrong.
When in doubt, check the online unity docs. The easiest way is to google. for instance googling "Unity Vector3" would pop the docs for Vector3 up so you can check that you got the field spelling right.
Thank you but, I still have one problem.
'foward' is not a member of 'UnityEngine.Vector3
Internal compiler error. See the console log for more information. output was:BCE0011: An error occurred during the execution of the step 'Boo.Lang.Compiler.Steps.EmitAssembly': 'Cannot cast from source type to destination type.'.
Your answer
![](https://koobas.hobune.stream/wayback/20220613150358im_/https://answers.unity.com/themes/thub/images/avi.jpg)