- Home /
Question by
themajesticcyka · Jan 19, 2017 at 05:19 AM ·
var
The BCE0005 has occurred in one of my scripts, even though I have already specified the use of "DamageAmount" in my previous scripts as a var, i need help solving this issue.
var DamageAmount :int = 5;
var TargetDistance : float;
var AllowedRange : float = 15;
function Update () {
if (Input.GetButtonDown("Fire1")) {
var Shot : RaycastHit;
if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.forward), Shot)) {
TargetDistance = Shot.distance;
if (TargetDistance < AllowedRange) {
Shot.transform.Sendmessage("DeductPoints", DamageAmount, SendMessageOptions.DontRequireReciever);
}
}
}
}
This is the previous script that DamageAmount was used and this one worked fine.
var EnemyHealth : int = 10;
function Deductpoints (DanageAmount : int) {
EnemyHealth -= DamageAmount;
}
function Update () {
if (EnemyHealth <=0) {
Destroy(gameObject);
}
}
This is the script the error comes with.
Comment
Your answer
Follow this Question
Related Questions
how do I edit prefab variables? 1 Answer
Decrease int variable over time 4 Answers
Raycast problems unexpected token var etc. 2 Answers
One of my scripts can't find the variable from this script 1 Answer
Spawn object every 5 coins collected 2 Answers