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();
}
}
Not possible. Resources.LoadAll will return an array. However there is no reason you need to make the array a class variable, simply declare it at the method level and let it fall out of scope naturally.
For whoever has run into to same problem, some code for ya
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public class listResouresTest01 : MonoBehaviour
{
public List <GameObject> myList;
void Start()
{
//List = Array of "Resources" folder to List
myList = Resources.LoadAll<GameObject>("myPrefab").ToList();
}
}