- Home /
how to perform undo action in unity?
I have tried to perform undo action but actually it was working once in editor mode . Also it was not working on device. I want to track object position, rotation and enabling/disabling gameObject . Thanks in advance.
Answer by FatsWaller · Jul 25, 2018 at 08:40 AM
Mac: Command + Z
Windows: Ctrl + Z
Sometimes it doesn't work if you undo too many times because there is a limit to how far you can go back. And some things simply cant be undone.
Thanks a lot, but i need undo button operation in game.Not on unity engine.
Oh, well if that's the case, you would need a script that collects information that you would like to undo and compiles it into a list. Such as the objects position at a certain time or its rotation like you mentioned. From there, you make it so that when you press a certain key, it would go through the information list kinda thing and apply the information to the object.
i can undo position and rotation but problem game objects enable and disable. how do i undo certain objects when they are disable or enable(Undo.RecordObjects() this method is not working for me).
Answer by Malts_ · May 11, 2021 at 02:55 PM
To anyone still trying to undo a SetActive() action, using Undo.RegisterFullObjectHierarchyUndo() worked for me where Undo.RecordObject() did not.