Version: 5.4
public static Object[] LoadAll (string path);
public static Object[] LoadAll (string path, Type systemTypeInstance);

Parámetros

path Nombre de ruta de la carpeta de destino. Cuando se utiliza el string vacío (es decir, ""), la función cargará todo el contenido de la carpeta Resources.
systemTypeInstance Filtro de tipo para los objetos retornados.

Descripción

Carga todos los assets en una carpeta o archivo en path en una carpeta Resources.

If path refers to a folder, all assets in the folder will be returned. If path refers to a file, only that asset will be returned. The path is relative to any Resources folder inside the Assets folder of your project.

Note:
All asset names and paths in Unity use forward slashes, paths using backslashes will not work.

// Loads all assets in the "Resources/Textures" folder
// Then picks a random one from the list.
// Note: Random.Range in this case returns [low,high)
// range, i.e. the high value is not included in the range.

using UnityEngine; using System.Collections;

public class ExampleClass : MonoBehaviour { void Start() { GameObject go = GameObject.CreatePrimitive(PrimitiveType.Cube); Texture2D[] textures = (Texture2D[]) Resources.LoadAll("Textures"); Texture2D texture = textures[Random.Range(0, textures.Length)]; go.GetComponent<Renderer>().material.mainTexture = texture; } }

public static T[] LoadAll (string path);

Parámetros

path Nombre de ruta de la carpeta de destino. Cuando se utiliza el string vacío (es decir, ""), la función cargará todo el contenido de la carpeta Resources.

Descripción

Carga todos los assets en una carpeta o archivo en path en una carpeta Resources.

If path refers to a folder, all assets in the folder will be returned. If path refers to a file, only that asset will be returned. Only objects of type T will be returned. The path is relative to any Resources folder inside the Assets folder of your project.