Melee combat help!

I am using BurgZergArcade tutorial and i am currently on the melee combat tutorial, now i am using this script which is from that tutorial
`using UnityEngine;
using System.Collections;

public class PlayerAttack : MonoBehaviour {
public GameObject target;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
	if(Input.GetKeyUp(KeyCode.F)) {
		Attack();
	}
}
private void Attack() {
	EnemyHealth eh = (EnemyHealth)target.GetComponent("EnemyHealth");
	eh.AddjustCurrentHealth(-10);
}

}`
and i am getting a error that states “type ‘EnemyHealth’ does not contain a definition for ‘AddjustCurrentHealth’ and no extension method ‘AddjustCurrentHealth’ of type 'EnemyHealth could be found (are you missing a using directive or an assembly refrence?)”

and i have no idea what this means, could someone help me out?

It means that unity can’t reach the function / method “AddjustCurrentHealth” of the EnemyHealth class.

Either that method does not exist, or you have spelled it wrong or unity can’t reach the file.

Hmm, by the way… I’m not sure but could it be because you are typecasting the target as an EnemyHealth class?

I suppose target is defined as a Gameobject since you’re trying to reach a component from it. By adding (EnemyHealth) before target means that you are trying to load that gameobject as if it was a EnemyHealth class ( If I’m not mistaken? ) :stuck_out_tongue: So comment that line out and try this:

EnemyHealth eh = target.GetComponent< EnemyHealth >();