Version: 2022.3
언어: 한국어

AssetDatabase.LoadAllAssetRepresentationsAtPath

매뉴얼로 전환
public static Object[] LoadAllAssetRepresentationsAtPath (string assetPath);

설명

Returns all sub Assets at assetPath.

This function only returns sub Assets that are visible in the Project view.
All paths are relative to the project folder, for example: "Assets/MyTextures/hello.png"

Note: Sub Assets can be added explicitly via AssetDatabase.AddObjectToAsset
See Also: AssetDatabase.LoadMainAssetAtPath, AssetDatabase.LoadAllAssetsAtPath, HideFlags.HideInHierarchy.

using UnityEngine;
using UnityEditor;

public class Example : MonoBehaviour { [MenuItem("AssetDatabase/LoadAllAssetRepresentationsAtPath")] private static void PrintSubAssets() { Object[] data = AssetDatabase.LoadAllAssetRepresentationsAtPath("Assets/MySpriteTexture.png");

Debug.Log(data.Length + " Sub Assets");

foreach (Object o in data) { Debug.Log(o); }

// outputs: // 4 Sub Assets // MyTexture_0 (UnityEngine.Sprite) // MyTexture_1 (UnityEngine.Sprite) // MyTexture_2 (UnityEngine.Sprite) // MyTexture_3 (UnityEngine.Sprite) } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961