Version: 2023.1
언어: 한국어
public static string ExtractAsset (Object asset, string newPath);

파라미터

asset The sub-asset to extract.
newPath The file path of the new Asset.

반환

string An empty string if Unity has successfully extracted the Asset, or an error message if not.

설명

Creates an external Asset from an object (such as a Material) by extracting it from within an imported asset (such as an FBX file).

NOTE: The feature is currently only available for materials embedded in model assets.

All file paths are relative to the project folder. For example: "Assets/Materials/myMaterial.mat".

Method throws ArgumentNullException when the Asset is null and ArgumentException when the file path is null or empty.

using UnityEngine;
using UnityEditor;

public class Extractor { public static void ExtractFromAsset(Object subAsset, string destinationPath) { string assetPath = AssetDatabase.GetAssetPath(subAsset);

AssetDatabase.ExtractAsset(subAsset, destinationPath);

AssetDatabase.WriteImportSettingsIfDirty(assetPath); AssetDatabase.ImportAsset(assetPath, ImportAssetOptions.ForceUpdate); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961