Unity 3D - 监听Prefab保存事件 :
using UnityEditor;
using UnityEngine;
/// <summary>
/// Prefab保存监听器
/// </summary>
public class PrefabSaveListener : Editor
{
[InitializeOnLoadMethod]
static void StartInitializeOnLoadMethod()
{
PrefabUtility.prefabInstanceUpdated = delegate (GameObject instance)
{
//保存时 打印Prefab的路径
Debug.Log(PrefabUtility.GetPrefabAssetPathOfNearestInstanceRoot(instance));
};
}
}