It seems to be unnecessarily difficult.
I can add to an Array just fine e.g.
using System.Collections;
using System.Collections.Generic;
public class listResouresTest01 : MonoBehaviour
{
public GameObject[] myArray;
void Start()
{
myArray = Resources.LoadAll<GameObject>("myPrefab");
}
}
But can’t seem to figure out the syntax for a List
Right now if I want to add Prefabs to a List I do it this way e.g.
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public class listResouresTest01 : MonoBehaviour
{
public List <GameObject> myList;
public GameObject[] myArray;
void Start()
{
myArray = Resources.LoadAll<GameObject>("myPrefab");
myList = myArray.ToList();
}
}
Is there a way to add Prefabs directly to a List?