im new to scripting so can you guys tell me what to do
UnassignedReferenceException: The
variable TheKnife of MeleeScipt has
not been assigned. You probably need
to assign the TheKnife variable of the
MeleeScipt script in the inspector.
UnityEngine.Component.GetComponent[Animation]
() (at
C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineComponent.gen.cs:45)
MeleeScipt.Update () (at
Assets/MeleeScipt.js:12)
#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>().Play("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);
}
}
}
}