Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Undo.SetTransformParent simply not undoing

Discussion in 'Scripting' started by ldaughtry, Aug 4, 2015.

  1. ldaughtry

    ldaughtry

    Joined:
    Oct 30, 2012
    Posts:
    38
    This is in Unity 4.6.7. Using as indicated in the docs:
    http://docs.unity3d.com/ScriptReference/Undo.html
    http://docs.unity3d.com/ScriptReference/Undo.SetTransformParent.html

    It's just not undoing the parenting. Has anyone else seen this? Is there some trick it it's usage that eludes me?

    It's a simple reparenting action executed after a GUILayout.Button in an EditorWindow inherited class:
    Code (csharp):
    1. Undo.SetTransformParent(targetGO.transform, newParentGO.transform, "Move To Blah");
    The parenting itself happens properly. But I can't get it to undo at all. I've tried Undo.RecordObject with all other parents involved as well. Nothing is working.

    Anyone else seen anything like this?
     
    Last edited: Aug 4, 2015
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    how are you trying to do the undo? ctrl+z etc?
     
  3. ldaughtry

    ldaughtry

    Joined:
    Oct 30, 2012
    Posts:
    38
    Keyboard shortcuts and using the Edit > Undo menu both have the same effect.
     
  4. ldaughtry

    ldaughtry

    Joined:
    Oct 30, 2012
    Posts:
    38
    Really? No one? Logging as bug I guess.