- Home /
This question was
closed Jul 02, 2014 at 01:00 PM by
meat5000 for the following reason:
The question is answered, right answer was accepted
my sccripts/Health.js(26,26): BCE0019: 'Damage' is not a member of 'Bullet'.
i don't why but i get a my "sccripts/Health.js(26,26): BCE0019: 'Damage' is not a member of 'Bullet'." here is my script
#pragma strict
var Health : int = 100;
var damage : int ;
var bullet : GameObject;
function Update ()
{
if(Health < 0)
{
DIE();
}
}
function OnTriggerEnter (hit : Collider )
{
if(hit.gameObject.tag == "Bullet")
{
bullet = hit.gameObject;
TakeDamage ();
}
}
function TakeDamage ()
{
var BulletScript : Bullet = bullet.GetComponent("Bullet");
damage = BulletScript.Damage;
Health -= damage;
}
function DIE ()
{
Debug.Log("I'm death");
Destroy(gameObject);
}
please help me i don't even understand the error =(
Comment
You haven't posted the BulletScript which is where the problem really is.
ok then here is the bullet script var SpeedBullet : float = 500;
function Start ()
{
rigidbody.AddForce(transform.forward * SpeedBullet);
}
should i put " public var Damage? "
Best Answer
Answer by DaveA · Oct 14, 2013 at 03:51 AM
BulletScript has to have a public variable called Damage.