UnityEngineUndo.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using UnityEngine;
  2. using Object = UnityEngine.Object;
  3. namespace UnityEditor.U2D.Animation
  4. {
  5. internal class UnityEngineUndo : IUndo
  6. {
  7. public void RecordObject(object o, string name)
  8. {
  9. var obj = o as Object;
  10. if (obj != null)
  11. Undo.RecordObject(obj, name);
  12. }
  13. public void RegisterCompleteObjectUndo(object o, string name)
  14. {
  15. var obj = o as Object;
  16. if (obj != null)
  17. Undo.RegisterCompleteObjectUndo(obj, name);
  18. }
  19. public void RegisterCompleteObjectUndo(object[] o, string name)
  20. {
  21. var obj = o as Object[];
  22. if (obj != null)
  23. Undo.RegisterCompleteObjectUndo(obj, name);
  24. }
  25. public void RegisterCreatedObjectUndo(object o, string name)
  26. {
  27. var obj = o as Object;
  28. if (obj != null)
  29. Undo.RegisterCreatedObjectUndo(obj, name);
  30. }
  31. public void DestroyObjectImmediate(object o)
  32. {
  33. var obj = o as Object;
  34. if (obj != null)
  35. Undo.DestroyObjectImmediate(obj);
  36. }
  37. public void ClearUndo(object o)
  38. {
  39. var obj = o as Object;
  40. if (obj != null)
  41. Undo.ClearUndo(obj);
  42. }
  43. public void IncrementCurrentGroup()
  44. {
  45. Undo.IncrementCurrentGroup();
  46. }
  47. }
  48. }