Im instanstiating Some Random prefabs, and I need to store those prfabs in an array, how could i do that?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Random = UnityEngine.Random;
public class MasterSpawner : MonoBehaviour
{
public Image[] Pannels;
public GameObject[] Plannets;
GameObject[] PlannetsSave;
bool UsedOnce = false;
public void RandomizeAndInstanciate()
{
if (!UsedOnce)
{
UsedOnce = true;
foreach (Image i in Pannels)
{
int R = Random.Range(1, Plannets.Length);
GameObject GO = Plannets[R];
Instantiate(GO, i.transform.position, i.transform.rotation);
}
}
}
}