using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RandomSpawn : MonoBehaviour
{
public Transform[] listObjects;
public GameObject Coin;
int random;
void Update()
{
if (Input.GetKeyUp(KeyCode.F))
{
random = Random.Range(0, listObjects.Length);
SpawnRandom();
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RandomSpawn : MonoBehaviour
{
public Transform[] listObjects;
public GameObject Coin;
int random;
void Update()
{
if (Input.GetKeyUp(KeyCode.F))
{
random = Random.Range(0, listObjects.Length);
SpawnRandom();
}
}
private void SpawnRandom()
{
Instantiate(Coin, listObjects[random].position, Quaternion.identity);
}
}