im new to scripting and i dont know anything about it so can you guys help me out with this animation that has to play when i press the “fire1” button.
i get this error:
Assets/MeleeScipt.js(12,42): BCE0017: The best overload for the method ‘UnityEngine.Component.GetComponent.()’ is not compatible with the argument list ‘(String)’.
#pragma strict
var Damage : int = 50;
var Distance : float;
var MaxDistance : float = 1.5;
var TheKnife : Transform;
function Update ()
{
if (Input.GetButtonDown("Fire1"))
{
TheKnife.GetComponent.<Animation>("Stab");
var hit : RaycastHit;
if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), hit))
{
Distance = hit.distance;
if (Distance < MaxDistance)
{
hit.transform.SendMessage("ApplyDamage", Damage, SendMessageOptions.DontRequireReceiver);
}
}
}
}