自动保存预制体

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
// 自动保存预制体
public class NewBehaviourScript : MonoBehaviour
{

    // Use this for initialization
    [InitializeOnLoadMethod]
    static void Start()
    {
        PrefabUtility.prefabInstanceUpdated = delegate
        {
            GameObject go = null;
            if (null != Selection.activeTransform) go = Selection.activeGameObject;

            AssetDatabase.SaveAssets();

            if (null != go)
            {
                EditorApplication.delayCall = delegate
                {
                    Selection.activeGameObject = go;
                };
            }
        };
    }


}


你可能感兴趣的:(自动保存预制体)