Hello there,
I was wondering if anyone could help me:
My error is:
“MissingComponentException: There is no ‘Animation’ attached to the “Main Camera” game object, but a script is trying to access it.
You probably need to add a Animation to the game object “Main Camera”. Or your script needs to check if the component is attached before using it.
UnityEngine.Animation.Play (System.String animation) (at C:/BuildAgent/work/d63dfc6385190b60/artifacts/EditorGenerated/Animations.cs:569)
meleeSystem.Update () (at Assets/meleeSystem.js:12)”
This is my code:
#pragma strict
var TheDammage : int = 50;
var Distance : float;
var MaxDistance : float = 1.5;
function Update ()
{
if (Input.GetButtonDown("Fire1"))
{
animation.Play("attackArbiter");
var hit : RaycastHit;
if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.forward), hit))
{
Distance = hit.distance;
if (Distance < MaxDistance)
{
hit.transform.SendMessage("ApplyDammage", TheDammage, SendMessageOptions.DontRequireReceiver);
}
}
}
}
Here is an image of the component attached to the game object arbiter
Could anyone tell me whats wrong, I’ve been writing in lua for the past year on corona and want to make this change happen.
Thank you
James