Instantiate a object after destroying a instantiated object.

Hello you all!

I am working on a snake alike game, just to get the feel for game development!

I have gotten a kind of apple spawn at a random location every time the game starts. It workes great, but when i destroy the object i collide with (apple) so it kinda picks it up or eats it, after that i dont know how to instantiate ONLY one more apple at a random location, and then repeat the proces.

Can you please help me and i will be greatful :)

So:

function Update () {
var appleTarget = GameObject.FindWithTag("Apple");

if( appleTarget == null )
{
  SpawnOneApple();
}

}

function SpawnOneApple()
{
   //Put code for spawning an apple here...
}

This'll always make sure one apple is on the board, because if one is gone, it spawns one, but if their is one their, then appleTarget isn't null...

Hope that helps =).