spawn prefabs in loop after collision

hi…im currently new at unity codes…can anyone help me about this problem…the thing is that i want a snowball prefab to respawn after collision(when the character hits a visible collider or whatever that triggers the collision) in a certain amount of loop like 10 snowballs…and it should have a gap like 1 sec per snowbal…

i did my research but i cant find any solution for my problem…i hope anyone can get my point… tnx a lot in advance…

You could use a coroutine:

C#:

public IEnumerator spawnSnowball(){
    for(int i = 0; i < numSnowballs; i++){
        // do snowball spawn
        yield return new WaitForSeconds(timeToWaitBetweenSpawns);
    }

}

pubic void OnTriggerEnter(Collider c){
    StartCoroutine("spawnSnoball");
}

You would have to customize to fit your situation but I think a coroutine is what you need.