Ejemplo n.º 1
0
    public void RegisterUndo(UnityEngine.Object[] objs, string name)
    {
        if (cmdCur != cmdCounter.Cur - cmdOffset)
        {
            syncCmd();
        }

#if UNITY_4_1
        Undo.IncrementCurrentEventIndex();
#endif

        Array.Resize <UnityEngine.Object>(ref objs, objs.Length + 1);
        objs[objs.Length - 1] = cmdCounter;

        ManagedCmd cmd = new ManagedCmd(objs, name);

        cmdList.Add(cmd);
        cmdCur++;


#if UNITY_4_3 || UNITY_4_5 || UNITY_4_6
        Undo.RegisterCompleteObjectUndo(objs, name);
#elif (UNITY_3_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_3_6 || UNITY_3_7 || UNITY_3_8 || UNITY_3_9)
        Undo.RegisterUndo(objs, name);
#else
        Undo.RecordObjects(objs, name);
#endif
        cmdCounter.Cur++;
    }
Ejemplo n.º 2
0
    public void RegisterSnapshot()
    {
        LayoutEditorWindow.Instance.SetCurLayoutDirty();
#if UNITY_4_1
        Undo.IncrementCurrentEventIndex();
#endif
        ManagedCmd cmd = new ManagedCmd(snapshotTarget, targetCmdName);
        cmdList.Add(cmd);
        cmdCur++;
        cmdCounter.Cur++;

#if UNITY_4_1
        Undo.RegisterSnapshot();
#endif
    }