Version: 5.3 (switch to 5.4b)
언어English
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Resources.LoadAll

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

닫기

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

닫기

취소

Switch to Manual
public static function LoadAll(path: string): Object[];
public static Object[] LoadAll(string path);
public static function LoadAll(path: string, systemTypeInstance: Type): Object[];
public static Object[] LoadAll(string path, Type systemTypeInstance);

파라미터

path Pathname of the target folder. When using the empty string (i.e., ""), the function will load the entire contents of the Resources folder.
systemTypeInstance Type filter for objects returned.

Description

Loads all assets in a folder or file at path in a Resources folder.

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. /path/는 프로젝트의 애셋 Assets 폴더에 내에 Resources 폴더의 상대경로입니다.

Note:
유니티에서 모든 애셋 이름과 경로는 전방 슬래쉬를 사용하교, 백 슬래쉬를 사용하는 경로는 작동하지 않을 것입니다.


        
// 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 function LoadAll(path: string): T[];
public static T[] LoadAll(string path);

파라미터

path Pathname of the target folder. When using the empty string (i.e., ""), the function will load the entire contents of the Resources folder.

Description

Loads all assets in a folder or file at path in a Resources folder.

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. /path/는 프로젝트의 애셋 Assets 폴더에 내에 Resources 폴더의 상대경로입니다.