- Home /
Question by
InvictusCo · Mar 12, 2017 at 03:01 PM ·
unity 5gun scriptgunfirequack
Why am I being told 'quack' is not a generic definition?
Assets/Scripts/HandGunDamage.js(6,27): BCE0138: 'quack' is not a generic definition. var DamageAmount : int = 34; var TargetDistance : float; var AllowedRange : float = 75;
function Update()
{if (!GetComponent.parent.<Animation>().isPlaying) {
{if(Input.GetButtonDown("Attack"))
{var Shot : RaycastHit;
if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.forward), Shot))
{TargetDistance = Shot.distance;
if (TargetDistance < AllowedRange)
{Shot.transform.SendMessage("DeductPoints", DamageAmount);}}}}}}
Comment
Answer by tanoshimi · Mar 12, 2017 at 03:03 PM
I don't use Javascript, but this line (which I think is line 6, but hard to tell) looks wrong:
if (!GetComponent.parent.<Animation>().isPlaying)
What are you trying to do here? Find out whether the animation component on the parent object of this transform is not playing? Then that would probably be:
if (!transform.parent.GetComponent.<Animation>().isPlaying)
Your answer
Follow this Question
Related Questions
"WARNING: Boolean expression will always have the same value." 0 Answers
replacing guns and knife 0 Answers
How do you add force to a clone after you spawn it? 3 Answers
How would I add force/ burst fire to my gun? 2 Answers
Problem with events 1 Answer