How to spawn power ups at random places on random time internvals

So i am building this top down space shooter type of game and i need to spawn random power ups at random places at a random time. I am kind of new to unity and c# so your help will be greatly appriciated :smiley:

Please give us more info.

Does the screen scroll?

Within the area you want to spawn objects, are there spots you would like to avoid when attempting to spawn the objects? Like other objects, for example.

What is your current knowledge and what have you tried already?

Do you know how to use Random.Range?

Do you know how to use GameObject.Instantiate to spawn objects?

Have you played around with the Invoke method which can call a function after X seconds?

Vector3s are always a pain, but I have created a little script that should help you with the positions bit. Unfortunately, I still haven’t got my head around Unity’s Time function, so I can’t help you there.

public float ranX;
public float ranZ;
public Vector3 ranPos;

// Update is called once per frame
void Update () {

    if (Input.GetKeyDown(KeyCode.Space) == true)
    {
        ranX = Random.Range(0f, 20f);
        ranZ = Random.Range(0f, 20f);

        ranPos = new Vector3(ranX, 1.0f, ranZ);
        Debug.Log("Chosen position" + ranPos);
       
    }
}

The script currently prints the randomly chosen position to Debug when the spacebar is pressed, so you’d have to adapt it for your project. You’ll also have to re-add the imports and class. Hope this helps.