How to time damage with attacking animation

I’m new to Unity and I learnt how to implement combat in my game using a Brackeys tutorial. He starts explaining how to register damage at around 12:05: MELEE COMBAT in Unity - YouTube

In the video he registers the damage to the enemy as soon as the animation starts, which is fine in his case but in my game my character attacks slower. In my game when the player attacks he prepares the swing for about 0.30 sec and then he strikes.

Right now it registers the damage before my character has hit the enemy, how do I fix this problem?

You could use an Animation Event (Unity - Manual: Using Animation Events) to call the Attack method 0.3 seconds into your attack animation. I’d then just modify void Update() so that it triggers the attack animation directly:

void Update()
        if (Input.GetKeyDown(KeyCode.Space))

    void Attack ()
        //Detect enemies in range of attack
        //Damage them

use a coroutine to delay animation. When the animation for attack is called, instead of immediately register damage:

using UnityEngine;
using System.Collections;

public float DamageDelay;

StartCoroutine(DelayForDamage());//this line instead of actual damage

private IEnumerator DelayForDamage(){
		yield return new WaitForSeconds(DamageDelay);
//here is where you register damage. DamageDelay is how long into animation damage should start