hi i am following BuurgZergArcade’s tutorial
but
now i have a little problem
i get two errors in this scipt:
Assets/ascipts/PlayerAttack.cs(27,47): error CS0103: The name `target’ does not exist in the current context
and
Assets/ascipts/PlayerAttack.cs(22,51): error CS0103: The name `target’ does not exist in the current context
using UnityEngine;
using System.Collections;
public class PlayerAttack : MonoBehaviour {
public GameObject traget;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(Input.GetKeyUp(KeyCode.F)) {
Attack();
}
}
private void Attack() {
float distance = Vector3.Distance(target.transform.position, transform.position);
Debug.Log(distance);
if(distance < 2.5f) {
EnemyHealth eh = (EnemyHealth)target.GetComponent("EnemyHealth");
eh.AddjustCurrentHealth(-10);
}
}
}
some one knows what is wrong in this scipt?[/b]