Multi Random Spawn Enemies / Item

I can not think of what I should do.
I need help in the picture you can see that I have spawn points and that I can decide how many I want, of a completely simple empty object that is my spawn point. and you will see that I have frefabs for items or enemies. but what I want to change that for each element in spwan point I want applicants feature prefabs.

[25581-it+looks.png|25581]

I want it to look like this
“”“this photo is made in paint”“” XD

[25580-i+want.png |25580]

you might already understand what I want.

that I may be able to place different things in the different spawn.
so that not all spawns, spawns from the same frefabs list

here is the Spawn E&I script.

var spawnPoints : Transform[];  // Array of spawn points to be used.
var Prefabs : GameObject[]; // Array of different Enemies or Item that are used.

function Start(){
    Spawn();
}

function Spawn(){ 

      var obj : GameObject = Prefabs[Random.Range(0, Prefabs.length)]; // Randomize the different enemies or Item to instantiate.
      var pos: Transform = spawnPoints[Random.Range(0, spawnPoints.length)];  // Randomize the spawnPoints to instantiate enemy or Item at next.

      Instantiate(obj, pos.position, pos.rotation); 
}

:smiley: BIG ThX to you who will help me, Really appreciate it :slight_smile:

You’ll want to set up a class for your spawn points.

var spawnPoints : SpawnPoints;

class SpawnPoints {
   var spawnTransform : Transform;
   var prefabs : GameObject[];
}

You can then access each element of the class like so:

var obj : GameObject = spawnPoints[x].prefabs[Random.Range(0, spawnPoints[x].prefabs.length)];

Ex. spawnPoints.spawnTransform = gameObject.transform;

The question’s already answered, but just a reminder: RandomRange is inclusive/exclusive.
So if you make a float value that’s a Random.Range(0, 5) It can be any number from 0 to 4. An Int would be 0 to 4.9999999999999999999999999… you get the point.
So to make the whole list, you need to say Random.Range(0, ValueYouWant.length + 1) to include the top.

Sorry, I have a question… when you set the Random.Range, shouldn’t be the screen’s width and height the parameters? So the items and enemies appears inside the screen… I’m pretty new at this… greetings :slight_smile: