Hello everybody and good day.
I have a little problem trying to make an Undo step after creating a bunch of objects using a for loop method (in edit not play), I read the docs about it but honestly I don’t understand how that could be done or even if that it’s possible.
I know that undo a group of selected objects can be done after deletion but not at creation, so, any one could help me to resolve this?, I’m not an experienced programmer, but I can understand many things about coding inside Unity (except this one about Undo group things).
In version 2018.4.13f1 when this line is executed Undo.RecordObject(null, "Base Undo"); I get this error Undo object may not be null. Also you're using Undo.CollapseUndoOperations(undoID) every time you create a new object. I think this the correct way Undo.IncrementCurrentGroup(); Undo.SetCurrentGroupName("Undo name"); var undoGroupIndex = Undo.GetCurrentGroup(); for (int i = 0; i < 10; i++) { GameObject go = Instantiate(original); Undo.RegisterCreatedObjectUndo(go, ""); } Undo.CollapseUndoOperations(undoGroupIndex);
– PedroPoni