Would this work for melee in an FPS?

If I created a weapon similar to the grenade launcher from the FPS tutorial, could I make it shoot an invisible sphere collider instead of a sphere, and set that collider to disappear after a second or so (thereby only functioning in "melee range")?

Would this work?

I guess it would work but here is how i did my melee attack (keep in mind it is more or less a suicide bomber, it charges you, when it gets in range it blows up dealing damage):

//set player as your player
var player : Transform;
//distancePlayer is how far away it is before it deals damage
var distancePlayer : float = 2;
//this should be obvious
var damage : int = 5;
//as it is a suicide bomber it will create this when it goes boom.
var blowup : Transform;

function Update () {
//sets the calculations 
var distFromPlayer : Vector3 = player.position - transform.position;
//checks to see if the player is in range
if(distFromPlayer.magnitude < distancePlayer) {
//deals damage, though this works with my other script which is long and complicated
new MessagePlayerHit(damage);
//makes the explosion particle system, probably not useful for you
Instantiate(blowup, transform.position, Quaternion.identity);
//destroys the enemy, also probably not useful for you
Destroy (gameObject);

Hope this helps you out!