Version: 2022.2
언어: 한국어
public static void StopAssetEditing ();

설명

Stops 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(); } } }