Version: 2020.3
public static void StartAssetEditing ();

설명

Starts importing Assets into the Asset Database. This lets you group several Asset imports together into one larger import.

Note:
Calling AssetDatabase.StartAssetEditing() places the Asset Database in a state that will prevent imports until AssetDatabase.StopAssetEditing() is called. This means that if an exception occurs between the two function calls, the AssetDatabase will be unresponsive. Therefore, it is highly recommended that you place calls to AssetDatabase.StartAssetEditing() and AssetDatabase.StopAssetEditing() inside either a try..catch block, or a try..finally block as needed.

using UnityEngine;
using UnityEditor;

public class StartStopAssetEditingExample : MonoBehaviour { [MenuItem("APIExamples/StartStopAssetEditing")] static void CallAssetDatabaseAPIsBetweenStartStopAssetEditing() { try { //Place the Asset Database in a state where //importing is suspended for most APIs AssetDatabase.StartAssetEditing();

AssetDatabase.CopyAsset("Assets/CopyAsset.txt", "Assets/Text/CopyAsset.txt"); AssetDatabase.MoveAsset("Assets/MoveAsset.txt", "Assets/Text/MoveAsset.txt"); } finally { //By adding a call to StopAssetEditing inside //a "finally" block, we ensure the AssetDatabase //state will be reset when leaving this function AssetDatabase.StopAssetEditing(); } } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961