Instantiate In 3 seconds?

I know how to Destroy a gameobject after 3 seconds

Destroy(gameObject, 3.0);

has passed but how do I instantiate a gameobject in 3 seconds?

Instantiate(ptrScriptVariable.Health, transform.position, Quaternion.identity );

Also how do I instantiate a gameobject near a player instead of right on him. How do I adjust the transform.position.z so its like instantiate away from the character like 5 spaces but randomly placed on the x axis so basically there is an area around the gameObject where it can be instantiated.

transform.position.z = transform.position.z + Random value (a few spaces from character)

I didn’t test it, but this should work. I’d suggest looking up the documentation for anything in it you don’t already know.

var someRange : float;
var thing : GameObject;

function Start () {
var pos = transform.position;
pos += Random.insideUnitSphere * someRange;
yield WaitForSeconds(3);
Instantiate( thing, pos, Quaternion.identity);
}

Use the ‘Invoke’ command to call a method after a set amount of time.

In C# it would be something like…

void CreateGameObject()
{ 
       Vector2 randomVec = Random.insideUnitCircle * 5;
       Vector3 spawnPos = transform.position;
       spawnPos.x += randomVec.x;
       spawnPos.y += randomVec.y;

        Instantiate( somePrefab, spawnPos );
}

void OnFire()
{
     //call the CreateGameObject method in 3 seconds
      Invoke( "CreateGameObject", 3.0f );
}