IEnumerator workaround.. not working around.

So I had a very hard time getting an IEnumerator to work in order to delay my projectile from firing, so I decided to (try and) get clever.

My spear thrower takes about 1 second to get to the point in his animation where he “releases” the spear.

All I did was put a collider on his hand, and a collider on the spawn point of the spear projectile. This way I won’t have to use any IEnumerator, the spear simply spawns once his hand hits the area that the spear releases. Later (if this works) I’ll add in code that will destroy the existing spear in his hand, but this isn’t working. Any suggestions? Am I doing this all wrong?

Attached: A picture of my colliders.

Attached: The script that is attached to my players hand.`using UnityEngine;
using System.Collections;

///
/// This script is attached to the player and allows
/// them to fire the Blaster projectile.
///

public class FireBlaster : MonoBehaviour {

//Variables Start___________________________________

//The blaster projectile is attached to this in the 
//inspector

public GameObject spear;
public GameObject righthand;

//Quick references.

private Transform myTransform;

private Transform bulletSpawn;

//The position at which the projectile should be
//instantiated.

private Vector3 launchPosition = new Vector3();

//Used to control the rate of fire.

private float fireRate = 0;

private float nextFire = 0;

//Variables End_____________________________________

void OnCollisionEnter(Collision col)
{
	if (col.gameObject.name == "bulletSpawn") {
		nextFire = Time.time + fireRate;

		//The launch position of the projectile will be just in front
		//of the spawn point.

		launchPosition = bulletSpawn.TransformPoint (0, 0, 1.2f);

		//Create the blaster projectile at the launchPosition and tilt its angle
		//so that its horizontal using the angle eulerAngles.x + 90.

		Instantiate (spear, launchPosition, Quaternion.Euler (bulletSpawn.eulerAngles.x + 90,
			myTransform.eulerAngles.y, 0));

	}

}

// Use this for initialization
void Start ()
{

	myTransform = transform;

	bulletSpawn = myTransform.Find ("bulletSpawn");

}

}`

I have a similar situation in my project where the character dig’s earth. I dont want the “dug earth” prefab to appear as soon as the player clicks, I want it to appear once the shovel hits the ground, which is about halfway through my animation. A very simple and easy way I do this is with a CoRoutine.

just call this CoRoutine and pass in the object you want to spawn and how long you want to wait, you could pass in the time of the animation if you want it to spawn after the animation. I do animationTime * .5f so it spawns halfway through the dig animation.

IEnumerator TimedItemSpawn (GameObject go, float timeToWait){
     yield return new WaitForSeconds(timeToWait);
     Instantiate( go );
}