Version: 2022.1
언어: 한국어
public static void Refresh (ImportAssetOptions options= ImportAssetOptions.Default);

설명

Import any changed assets.

This will import any assets that have changed their content modification data or have been added-removed to the project folder.

This method implicitly triggers an asset garbage collection (see Resources.UnloadUnusedAssets).

See Also: ImportAssetOptions.

using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEngine;

public class AssetDatabaseExamples : MonoBehaviour { [MenuItem("AssetDatabase/Refresh Example")] public static void RefreshExample() { var folderList = new List<string>{"Textures", "Models", "Sounds"}; foreach (var folder in folderList) { Directory.CreateDirectory($"Assets/{folder}"); }

foreach (var folder in folderList) { //Output will be false Debug.Log(AssetDatabase.IsValidFolder($"Assets/{folder}")); }

AssetDatabase.Refresh(); foreach (var folder in folderList) { //Output will be true Debug.Log(AssetDatabase.IsValidFolder($"Assets/{folder}")); } } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961