Completley Random Spawning 2D(Random ANYWHERE ON THE SCREEN

My script below is spawning to many gameobjects (fly)
What I want is to spawn one every2 seconds and from random places anywhere on screen

Im looking for a Script for Completley Random Spawning When I say random I mean locations it spawns from. ITS a 2D game

Not an array with set locations but I mean absolutely ANYWHERE on the screen all random ! I think it would include something like random x random y etc

Random meaning ANYWHERE ON THE SCREEN hopefully not using any list of arrays etc just simple script I can place on enemy’s and they can pop up anywhere on the screen every 2 seconds. I searched but since im new to scripting its hard to find and link one I tried for hours .watched so many tutorials but these need to be detail corrected and you have to know where to put the values I hope someone can help me and post or correct my script for me. Best karma to anyone who can get this to work for me

This is javascript
Please feel free to correct this script i have here and repost it

#pragma strict

var fly : GameObject;
var spawnValues : Vector2;
var flyCount : int;
var spawnWait : float;
var startWait : float;
var waveWait : float;

function Start () {
    SpawnWaves ();

 }
function SpawnWaves () {
    yield WaitForSeconds (startWait);
    while (true)
    {
        for ( var i : int= 0; i < flyCount; i++)
        {
             var spawnPosition : Vector2= new Vector2 (Random.Range (-spawnValues.x, spawnValues.x), spawnValues.y);
             var spawnRotation : Quaternion= Quaternion.identity;
            Instantiate (fly, spawnPosition, spawnRotation);
            yield WaitForSeconds (spawnWait);
        }
        yield WaitForSeconds (waveWait);
    }
}

For your spawnPosition, use the following:

 #pragma strict
var fly : GameObject;
var spawnValues : Vector2;
var flyCount : int;
var spawnWait : float;
var startWait : float;
var waveWait : float;
function Start () {
SpawnWaves ();
}
function SpawnWaves () {
yield WaitForSeconds (startWait);
while (true)
{
for ( var i : int= 0; i < flyCount; i++)
{
var spawnPosition : Vector2 = new Vector2 (Random.Range (0, Screen.width), Random.Range (0, Screen.height));
//var spawnPosition : Vector2= new Vector2 (Random.Range (-spawnValues.x, spawnValues.x), spawnValues.y);
var spawnRotation : Quaternion= Quaternion.identity;
Instantiate (fly, camera.ScreenToWorldPoint(new Vector3(spawnPosition.x, spawnPosition.y, 10)), spawnRotation);
yield WaitForSeconds (spawnWait);
}
yield WaitForSeconds (waveWait);
}
}

You don’t need the public Vector2 spawnValues as the Screen class contains the width and height of the screen. camera.ScreenToWorldPoint converts the random screen point to a world point. Note: You can use any value except 10 as the third parameter to camera.ScreenToWorldPoint. Add this script to your main camera (or if you want it on another gameObject (don’t add it on the fly game object) replace camera with Camera.main).

EDIT: Result: alt text