Melee weapon

Im having some problems getting my melee combat to work. Im making a game and for this game i need to be hitting enemies with a katana. I already have the katana model but i do not have the script for meleeing or for the enemies you will be hitting. Can anyone help me

Create a cube gameobject, give it a Box Collider, then disable or delete the Mesh Renderer. Set the Box Collider to “Is Trigger” = true.

Add a new script to the object which tracks wether an enemy is colliding with it via OnTriggerStay. Add a new gameObject variable “attackBox” to your character’s attack script. Make the attack cube object assign the enemy it collides with to it’s target variable.
Make the object a child of your character and change the position so it sits just in front of the character.

In your character control script, whenever you push the attack button, check if the enemy variable of the attackBox variable is null and if not, you can apply damage.

using UnityEngine;
using System.Collections;

public class AttackBox : MonoBehaviour {

	public GameObject target;

	void Start() {
		if(transform.root.GetComponent<TestInput>()) {
			transform.root.GetComponent<TestInput>().attackBox = this;
		}
	}

	//The AttackBox Layer ignores everyhing but the Actor Layer!
	void OnTriggerStay(Collider other) {
		if(other.GetComponent<TestInput>() == false) {
			target = other.gameObject;
		}
	}

	void OnTriggerExit(Collider other) {
		if(other.gameObject == target) {
			target = null;
		}
	}
}