using UnityEngine;
using System.Collections.Generic;
public class Spawner : MonoBehaviour
{
public GameObject[] Monsters;
public Transform[] spawnpoint;
public float time = 0;
void Start ()
{
}
void Update ()
{
time +=
1*Time.deltaTime;
if(time >= 5)
{
time -= 5;
int spawnpointindex = Random.Range (0, spawnpoint.Length);
Instantiate (Monsters[0], spawnpoint[spawnpointindex].position, spawnpoint[spawnpointindex].rotation);
}
}
}
This is my code so far, I’m pretty new to coding so I needed to ask since I can’t ask anyone else. Is there a way to random between two objects while spawning continuously and has an option to put allocation on the chances that they can be spawned? For example, 60% for Object A and 40% for Object B